Unloading Components

DekaFlash, if you want to remove PictureBox1 from form you can do this:
VB.NET:
Me.Controls.Remove(PictureBox1)
If the PictureBox is on a Panel for instance do this:
VB.NET:
Panel1.Controls.Remove(PictureBox1)
 
How about unloading a component from the form?

If i have two components of the same type and I want to interchange them.
 
Last edited:
I still have no idea what you're talking about. What components? Are you talking about controls? What do you mean by "interchange them"? If you want to move a control then set its Location property. There's no "unloading" involved. The word "component" has a specific meaning in Windows Forms. A component is an object of a type that inherits the Component class. Components are the things that you add to a form in the designer and they appear at bottom of the screen, in the component tray. Is that what you're talking about? If you mean the objects on the form itself then they're more correctly called controls, although the Control class also inherits Component. If you were to give a bit more detail in the first place then there would be no need for assumptions or guess-work.
 
I have a Progress Bar control which progresses using a timer, it works ok the first time is it triggered.

On the next trigger it runs ten times to fast.

I am wondering if its possible to unload the first version of the control and load another one in between events, during runtime. This is in order to avoid confusion.
 
There's nothing inherent in either the ProgressBar or Timer that would cause that to happen. The code you are using must be broken. Fix the code and the issue will go away. Show us the code and maybe we can help.
 
Back
Top