S
sajones
Hello,
I'm a novice user having troubles retrieving data from a listbox in VB
Express 2005.
My listbox is populated by a table from an Access database.
I'm trying to assign the current listbox selection to a textbox using:
"Me.txtSelection.Text = CStr(lstUsers.Items(Me.lstUsers.SelectedIndex))"
When running this code I get the following error:
"InvalidCastException was unhandled. Conversion from type'DataRowView' to
type 'String' is not valid."
I'm assuming that this means that I'm trying to return the entire record
rather than a single field in the record. Unfortunately I don't know how to
return just a single field and I couldn't find anything in 'Help'.
Any assistance is greatly appreciated.
Thanks,
Scott
I'm a novice user having troubles retrieving data from a listbox in VB
Express 2005.
My listbox is populated by a table from an Access database.
I'm trying to assign the current listbox selection to a textbox using:
"Me.txtSelection.Text = CStr(lstUsers.Items(Me.lstUsers.SelectedIndex))"
When running this code I get the following error:
"InvalidCastException was unhandled. Conversion from type'DataRowView' to
type 'String' is not valid."
I'm assuming that this means that I'm trying to return the entire record
rather than a single field in the record. Unfortunately I don't know how to
return just a single field and I couldn't find anything in 'Help'.
Any assistance is greatly appreciated.
Thanks,
Scott