Imports System.Windows.Forms
Module MainModule
Public Sub ResetForm(ByVal FormToReset As Form)
Dim objControl As Control
For Each objControl In FormToReset.Controls
If TypeOf (objControl) Is System.Windows.Forms.TextBox Then
objControl.Text = "" ' Clear TextBox
ElseIf TypeOf (objControl) Is System.Windows.Forms.CheckBox Then
Dim objCheckBox As System.Windows.Forms.CheckBox = objControl
objCheckBox.Checked = False ' Uncheck CheckBox
ElseIf TypeOf (objControl) Is System.Windows.Forms.ComboBox Then
Dim objComboBox As System.Windows.Forms.ComboBox = objControl
objComboBox.SelectedIndex = -1 ' Deselect any ComboBox entry
End If
Next
End Sub
End Module