S
sajones
Hi,
I have a simple routine that populates a textbox with the value selected on
a listbox:
Private Sub lstUsers_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lstUsers.SelectedIndexChanged
'Displays specific field of list selection
Dim drv01 As DataRowView = DirectCast(lstUsers.SelectedItem,
DataRowView)
Me.txtSelection.Text = drv01("intUserID").ToString()
End Sub
It works great.
However, when I close the form, it errors on the value assignment with a
'System.NullReferenceException was unhandled' error.
In all reality, I don't even want it to try to do the assignment when I'm
closing the form. I'm guessing that the error has something to do with the
fact that the DataRowView is in the process of closing and can't be
referenced. Regardless, does anybody have any suggestions for getting
past/around this error?
Thanks,
Scott
I have a simple routine that populates a textbox with the value selected on
a listbox:
Private Sub lstUsers_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lstUsers.SelectedIndexChanged
'Displays specific field of list selection
Dim drv01 As DataRowView = DirectCast(lstUsers.SelectedItem,
DataRowView)
Me.txtSelection.Text = drv01("intUserID").ToString()
End Sub
It works great.
However, when I close the form, it errors on the value assignment with a
'System.NullReferenceException was unhandled' error.
In all reality, I don't even want it to try to do the assignment when I'm
closing the form. I'm guessing that the error has something to do with the
fact that the DataRowView is in the process of closing and can't be
referenced. Regardless, does anybody have any suggestions for getting
past/around this error?
Thanks,
Scott