Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Shared Sub EmptyTextBoxes(ByVal parent As Control,[b]ByVal tb As TextBox[/b])
For Each c As Control In parent.Controls 'LOOP THROUGHN ALL CONTROLS
If c.GetType() Is GetType(TextBox) Then 'IF ITS A TEXTBOX THEN EMPTY IT
CType(c, TextBox).Text = String.Empty
tb.Focus()
ElseIf c.GetType Is GetType(DropDownList) Then 'ELSE IF ITS A DROPDOWN LIST SET SELECTED VALUE TO -1
CType(c, DropDownList).SelectedIndex = 0
End If
If c.HasControls Then 'CALL ITSELF (GET ALL OTHER ELEMENTS IN OTHER CONTAINERS)
EmptyTextBoxes(c)
End If
Next
End Sub
ReportTemplate.EmptyTextBoxes(Me, *textbox name*)
public static void EmptyTextBoxes(Control parent, TextBox tb)
{
foreach (Control c in parent.Controls) {
if (c.GetType() == typeof(TextBox)) {
((TextBox)(c)).Text = string.Empty;
tb.Focus();
} else if (c.GetType == typeof(DropDownList)) {
((DropDownList)(c)).SelectedIndex = 0;
}
if (c.HasControls) {
EmptyTextBoxes(c, tb);
}
}
}