ClarusDignus

VB: Clear all Text Boxes and Combo Boxes

Nov 6th, 2014
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     Public Sub ClearBoxes(parent As Control)
  2.         For Each child As Control In parent.Controls
  3.             ClearBoxes(child)
  4.         Next
  5.         If TryCast(parent, TextBox) IsNot Nothing Then
  6.             TryCast(parent, TextBox).Text = ""
  7.         End If
  8.         If TryCast(parent, ComboBox) IsNot Nothing Then
  9.             TryCast(parent, ComboBox).SelectedIndex = -1
  10.         End If
  11.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment