G
Guest
I have a question in the following. Any one could give me a help?
Thanks
David
The dataset is declared and created at Class level. My source code is here:
Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lstPatientID.SelectedIndexChanged
txtDebug.Text &= lstPatientID.SelectedIndex.ToString
txtDebug.Text &= lstPatientID.SelectedIndex.ToString
txtLastName.Text =
ds.Tables("Patients").Rows(lstPatientID.SelectedIndex)("LastName")
When Page_load,
I use Dropdown list index to set all textboses. Now select another item in
Dropdown list, I got the following error at Line 323:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 321: txtDebug.Text &= lstPatientID.SelectedIndex.ToString
Line 322: txtDebug.Text &= lstPatientID.SelectedIndex.ToString
Line 323: txtLastName.Text =
ds.Tables("Patients").Rows(lstPatientID.SelectedIndex)("LastName")
Line: 323
Thanks
David
The dataset is declared and created at Class level. My source code is here:
Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lstPatientID.SelectedIndexChanged
txtDebug.Text &= lstPatientID.SelectedIndex.ToString
txtDebug.Text &= lstPatientID.SelectedIndex.ToString
txtLastName.Text =
ds.Tables("Patients").Rows(lstPatientID.SelectedIndex)("LastName")
When Page_load,
I use Dropdown list index to set all textboses. Now select another item in
Dropdown list, I got the following error at Line 323:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 321: txtDebug.Text &= lstPatientID.SelectedIndex.ToString
Line 322: txtDebug.Text &= lstPatientID.SelectedIndex.ToString
Line 323: txtLastName.Text =
ds.Tables("Patients").Rows(lstPatientID.SelectedIndex)("LastName")
Line: 323