In a ListBox that is databound, I want to get the SelectedValue when I click it.
lblMessage.Text = Me.lstSubCat.SelectedValue
But I get this error message:
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll
Additional information: Cast from type 'DataRowView' to type 'String' is not valid.
lblMessage.Text = Me.lstSubCat.SelectedValue
But I get this error message:
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll
Additional information: Cast from type 'DataRowView' to type 'String' is not valid.