Created
November 19, 2021 04:52
-
-
Save devCcori/5e0866015fa96b18562a2578999f491a to your computer and use it in GitHub Desktop.
Function to reset all Controls in a form VB.NET 5.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub resetAllControls(ByVal container As Control) | |
For Each ctrl As Control In container.Controls | |
If TypeOf ctrl Is RadioButton Then | |
DirectCast(ctrl, RadioButton).Checked = False | |
ElseIf TypeOf ctrl Is TextBox Then | |
DirectCast(ctrl, TextBox).Clear() | |
End If | |
If ctrl.Controls.Count > 0 Then | |
resetAllControls(ctrl) | |
End If | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment