FRoeCassNet
Programmer
I have an MDI application (VB.NET) and what I'm trying to
do is allow people to design a StatusBar on the Child
windows. When that window is opened, I add the panels
from the child window to the statusbar of the main
window. Giving a dynamic statusbar based on which child
form is active.
Since I can't add the panels from the child windows's
statusbar directly (gives error because the panel already
has a parent) in Form Load of the child window I add all
the panels to an array and then do a StatusBar.Clear to
remove the panels. The Clear removes the panels and
correctly sets each panel's parent property to Nothing.
Here's the problem, When the user switches to another
child window, I remove the panels (that came from the
current child) by looping through it's array and executing
the Remove() method. This removes the panel, but doesn't
set the panel's parent property to Nothing. When the user
goes back to this form later and I try to add the panel
back in, I get the error because it still has the parent
from earlier. I don't want to use the Clear() method form
the main form, because I want to retain the panels that
were created on the main form, I just want to remove the
panels from the child form that is being "deactivated".
Does anyone know how I can remove the parent property from
the StatusBarPanel at runtime?
do is allow people to design a StatusBar on the Child
windows. When that window is opened, I add the panels
from the child window to the statusbar of the main
window. Giving a dynamic statusbar based on which child
form is active.
Since I can't add the panels from the child windows's
statusbar directly (gives error because the panel already
has a parent) in Form Load of the child window I add all
the panels to an array and then do a StatusBar.Clear to
remove the panels. The Clear removes the panels and
correctly sets each panel's parent property to Nothing.
Here's the problem, When the user switches to another
child window, I remove the panels (that came from the
current child) by looping through it's array and executing
the Remove() method. This removes the panel, but doesn't
set the panel's parent property to Nothing. When the user
goes back to this form later and I try to add the panel
back in, I get the error because it still has the parent
from earlier. I don't want to use the Clear() method form
the main form, because I want to retain the panels that
were created on the main form, I just want to remove the
panels from the child form that is being "deactivated".
Does anyone know how I can remove the parent property from
the StatusBarPanel at runtime?