S
Siv
I have a form that I programmatically generate some check boxes and labels on.
Later on when I want to draw the form with different data I want to clear
the previously created items and then put some new ones on.
In my code I am doing the following:
For Each ctrl In tpMain.Controls
If TypeOf (ctrl) Is CheckBox Then
If ctrl.Name.StartsWith("chkS") Then
ctrl.Visible = False
ctrl.Dispose()
End If
End If
End if
Next
What I am finding however is that in some cases controls that I know have
been affected by the above loop are staying on the form and not being made
invisible and then being disposed.
Is there a sure fire method of removing the controls rather than the dispose
method which presumably is not always removing the control for whatever
reason??
Siv
Later on when I want to draw the form with different data I want to clear
the previously created items and then put some new ones on.
In my code I am doing the following:
For Each ctrl In tpMain.Controls
If TypeOf (ctrl) Is CheckBox Then
If ctrl.Name.StartsWith("chkS") Then
ctrl.Visible = False
ctrl.Dispose()
End If
End If
End if
Next
What I am finding however is that in some cases controls that I know have
been affected by the above loop are staying on the form and not being made
invisible and then being disposed.
Is there a sure fire method of removing the controls rather than the dispose
method which presumably is not always removing the control for whatever
reason??
Siv