Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each tp As TabPage In tabs.TabPages
ClearFields(tp)
Next
End Sub
Private Sub ClearFields(ByVal cntr As Control)
For Each ctl As Control In cntr.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
ElseIf TypeOf ctl Is CheckBox Then
CType(ctl, CheckBox).Checked = False
ElseIf TypeOf ctl Is ComboBox Then
CType(ctl, ComboBox).SelectedIndex = -1
ElseIf ctl.HasChildren Then
ClearFields(ctl) ' <--------------------------------- Recurse into control with children
End If
Next
End Sub