G
Guest
Hello,
I'd like to use a visual basic class.function to iterate through the html
controls
and verify that the user entered something in the controls. But I cannot
figure out how to pass the current webform to the function.
Would anyone know how to do this?
I currently have this code in a function:
For Each child In c.Controls
If child.GetType.ToString = "System.web.ui.webcontrols.textbox" Then
txtbox = CType(child, TextBox)
' no blanks allowed.
If txtbox.Text.Equals("") Then
txtbox.BackColor = Color.Magenta
txtbox.Text = "required."
End If
End If
If child.GetType.ToString =
"System.web.ui.webcontrols.dropdownList" Then
ddl = CType(child, DropDownList)
' no blanks allowed.
If ddl.SelectedValue.Equals("") Then
ddl.BackColor = Magenta
End If
End If
Next
End If
Next
Thanks,
I'd like to use a visual basic class.function to iterate through the html
controls
and verify that the user entered something in the controls. But I cannot
figure out how to pass the current webform to the function.
Would anyone know how to do this?
I currently have this code in a function:
For Each child In c.Controls
If child.GetType.ToString = "System.web.ui.webcontrols.textbox" Then
txtbox = CType(child, TextBox)
' no blanks allowed.
If txtbox.Text.Equals("") Then
txtbox.BackColor = Color.Magenta
txtbox.Text = "required."
End If
End If
If child.GetType.ToString =
"System.web.ui.webcontrols.dropdownList" Then
ddl = CType(child, DropDownList)
' no blanks allowed.
If ddl.SelectedValue.Equals("") Then
ddl.BackColor = Magenta
End If
End If
Next
End If
Next
Thanks,