SonicBoomAu
Centurion
Hi All,
Is it possible to do something like this??
I get a blue line under "ErrorProvider1.SetError(Txt.Name, " and "ErrorProvider1.SetError(Cbo.Name"
The mouse over states "Value of type 'String' cannot be converted to 'System.Windows.Forms.Control"
BTW i'm using VB .Net 2003
Thanks you for your time and help in advance.
Is it possible to do something like this??
I get a blue line under "ErrorProvider1.SetError(Txt.Name, " and "ErrorProvider1.SetError(Cbo.Name"
The mouse over states "Value of type 'String' cannot be converted to 'System.Windows.Forms.Control"
Visual Basic:
' Loop through each control on the StaticGroupBox
' If control.text is blank then display error icon on that feild
Dim Ctrl As Control
Dim Txt As TextBox
Dim Cbo As ComboBox
For Each Ctrl In Me.gbxSecurityInfo.Controls
If TypeOf (Ctrl) Is TextBox Then
Txt = CType(Ctrl, TextBox)
If Txt.Text = vbNullString Then
' Display Error Icon next to control
ErrorProvider1.SetError(Txt.Name, "This feild can not be left blank")
Else
ErrorProvider1.SetError(Txt.Name, "")
End If 'Txt.Text = vbNullString Then
End If ' TypeOf (CTRL) is TextBox
If TypeOf (Ctrl) Is ComboBox Then
Cbo = CType(Ctrl, ComboBox)
If Cbo.Text = vbNullString Then
' Display Error Icon next to control
ErrorProvider1.SetError(Cbo.Name, "This feild can not be left blank")
Else
ErrorProvider1.SetError(Cbo.Name, "")
End If 'Cbo.Text = vbNullString Then
End If ' TypeOf (Ctrl) Is ComboBox Then
Next
BTW i'm using VB .Net 2003
Thanks you for your time and help in advance.