Thursday, January 3, 2013

Use controls property by loop in panel


    Public Sub ClearPanel(ByVal objPanel As Panel)
        Dim cntrl As Control
        For Each cntrl In objPanel.Controls
            If TypeOf cntrl Is TextBox Then
                cntrl.Text = ""
            ElseIf TypeOf cntrl Is CheckBox Then
                DirectCast(cntrl, CheckBox).Checked = False
            End If
        Next
    End Sub

No comments:

Post a Comment