delete all controls from list of control vb.net code example

Example 1: delete all controls from list of control vb.net

For Each control As Control In MyListOfControls

            control.Dispose()

        Next

Example 2: delete all controls in an area vb

Private Sub ClearControls()
    'removing the controls from Me.Controls
    Me.SuspendLayout()
    For Each Control As Control In ListToDelete
        Me.Controls.Remove(Control)
    Next
    Me.ResumeLayout()
    ListToDelete = New List(Of Control)
End Sub

Tags:

Vb Example