M-RaH
Active member
I have a couple textboxes and comboboxes in my form and a button to go to another panel in the form ( with the data entered )... and want to check if al my controls are filled in ... ( both the textbox and the combobox )
so if i click the button all the controls have to be filled in before the next panel opens ...
This is what i wrote ... But i'm a .Net starter so i guess i missed some points in my code because it's not working ...
This is the error i get:
An unhandled exception of type 'System.InvalidCastException' occurred in Emrah.exe
Additional information: Specified cast is not valid.
Can someone help me with this
so if i click the button all the controls have to be filled in before the next panel opens ...
VB.NET:
[SIZE=2][COLOR=#0000ff]
Public[/COLOR][/SIZE] Sub[SIZE=2] Required()
[/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] control [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] TextBox [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] NAW.Controls
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] control.Text = "" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]MsgBox("U forgot some required fields", MsgBoxStyle.OKOnly, "Error")
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE][SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] Sub
[/COLOR][/SIZE]
This is the error i get:
An unhandled exception of type 'System.InvalidCastException' occurred in Emrah.exe
Additional information: Specified cast is not valid.
Can someone help me with this
Last edited by a moderator: