Patrick A
2009-12-31 22:49:13 UTC
Can anyone help me understand why neither of the following code snips
won't clear all of the Buttons on my form?
'A: Specify Buttons
For Each ctl As Control In Me.Controls
If TypeOf ctl Is Button Then
Me.Controls.Remove(ctl)
End If
Next
'B: Specify Not Menu Strip
For Each ctl As Control In Me.Controls
If Not TypeOf ctl Is MenuStrip Then
Me.Controls.Remove(ctl)
End If
Next
won't clear all of the Buttons on my form?
'A: Specify Buttons
For Each ctl As Control In Me.Controls
If TypeOf ctl Is Button Then
Me.Controls.Remove(ctl)
End If
Next
'B: Specify Not Menu Strip
For Each ctl As Control In Me.Controls
If Not TypeOf ctl Is MenuStrip Then
Me.Controls.Remove(ctl)
End If
Next