Friday, October 27, 2006

clears all of the dynamically generated controls

This subroutine clears all of the dynamically generated controls .
It does this by removing all of the controls, then calling the InitializeComponent() subroutine that was automatically generated by Visual Studio .NET.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' Clear all the controls.
Controls.Clear()
' Re-Add all of the original controls
InitializeComponent()
' Reset the m_Location to its original location.
m_Location = New Point(10, 10)
' Reset the number of controls.
m_ControlCount = 0
' Show the form again.
Show()
End Sub

0 Comments:

Post a Comment

<< Home