I'm trying to populate a bunch of controls in a form and I keep getting this error at line 206:
Can anyone tell me what I am doing wrong?
I know the datareader is being populated, because it displays data in the text boxes when I test it. But when I include the DropdownLists in the test it errs out.
Code:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 204: Me.txtDescr.Text = dr("Descr")
Line 205: Me.cboClasstype.SelectedIndex = -1
Line 206: Me.cboClasstype.Items.FindByText(dr("Classtype")).Selected = True
Can anyone tell me what I am doing wrong?
I know the datareader is being populated, because it displays data in the text boxes when I test it. But when I include the DropdownLists in the test it errs out.