Resetting a Form : Frame Form « GUI « VB.Net






Resetting a Form

  

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

   
    
  








Related examples in the same category

1.Simple window frameSimple window frame
2.Form Opacity in VBForm Opacity in VB
3.Non rectangle window in VBNon rectangle window in VB
4.Get Frame Client Rectangle SizeGet Frame Client Rectangle Size
5.Snap to Control