I have a form with a \"Clear\" button.
When the user clicks \"Clear\", I want to clear the value of all the visible elements on the form. In the case of date contro
This comes straight from an article discussing techniques to use now that Control Arrays have been done away with going from VB6 to VB.NET.
Private Sub ClearForm(ByVal ctrlParent As Control)
Dim ctrl As Control
For Each ctrl In ctrlParent.Controls
If TypeOf ctrl Is TextBox Then
ctrl.Text = ""
End If
' If the control has children,
' recursively call this function
If ctrl.HasChildren Then
ClearForm(ctrl)
End If
Next
End Sub