I'm not sure from your post if you still have questions. One thing that looks like you may still be confused is the .dispose and .add. .dispose deletes the control from your program and frees the memory. The only way to do the .add is to recreate the control.
If you still have questions, post a little more detail about your program. Are you manually creating and adding controls to your forms or are they controls created via drag and drop using the GUI? Why are you trying to take them off of the form?
What do mean by "does not load"?
Control Events > Load. Since you told me that .remove does not delete the control, more than enough answer for me.
Whenever I .Add a control after I .Dispose it, I receive a message "can't access a disposed object"
My program deletes a control and adds it again. I don't want to use .Remove because it requires me to manually reload all variables.
I am asking is how do you remove a control?. Because when I use .Remove it does not restart the variables inside the said control.
My program adds and removes the control during runtime. When I add a custom control using .add it executes the LOAD event of the control, but when I remove a custom control using .remove and adds it again using .add it no longer executes the LOAD event as if the control was just hidden by the .remove.
This form adds and removes the custom control
Public Class SampleForm
Dim myControl As New CustomControl
Dim added As Boolean = False ' To prevent the program from adding more than one control
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
If added = False Then
.Left = 100
.Top = 100
.Visible = True
added = True
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
If added = True then
added = False
This custom control shows a message box whenever the EVENT LOAD is executed.
Public Class CustomControl
Private Sub CustomControl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Problem: The message box appears only once, during the first add.
You mention something about recreate, how is that exactly?