1 Previous Next 

Controls: Recursive testing all controls, here to clean all textboxes (including comboboxes).


This is a simpler sample to show how the recursive goes.

In this case all textboxes are set to spaces

Private Sub Form1_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        doclean(Me)
    End Sub
    Private Sub doclean(ByVal parentCtr As Control)
        Dim ctr As Control
        For Each ctr In parentCtr.Controls
            If TypeOf ctr Is TextBox Then
                ctr.Text = ""
            ElseIf TypeOf ctr Is ComboBox Then
                DirectCast(ctr, ComboBox).SelectedIndex = -1
            End If
            doclean(ctr)
        Next
End Sub

 




1 Previous Next