Question null reference exception unhandled problem

Spartacus

New member
Joined
Feb 15, 2013
Messages
3
Programming Experience
Beginner
dear
i am beginner in ADO.net and this is my first program and i have some problems my data base as in picture
6GP1t-sMg1_920886942.png

so i need help to solve it ,, the problem is

null reference exception unhandled
as in picture below
v6pF3-cTB0_290398315.jpg
s



please any one have an idea how to solve this problem
 
Combobox2.SelectedValue is Nothing.
Use
VB.NET:
TextBox4.Text = String.Format("{0}", Combobox2.SelectedValue)
or test for Nothing
VB.NET:
If Combobox2.SelectedValue IsNot Nothing Then
    TextBox4.Text = Combobox2.SelectedValue.ToString
Else
    TextBox4.Clear
End If

Also: do yourself a favour and give your controls a more meaningful name.
 
Back
Top