listbox question

turrican

Active member
Joined
Jan 24, 2003
Messages
27
Location
Phoenix, Az
I have a windows form with a listbox and a datagrid. The listbox displays an entire column from a database in alphabetical order. I want to be able to select an item in the listbox and display the entire row from the database in the datagrid. I am trying to do a parameterized query using the listbox selected item. does that make sense.

Here is what I know:
It wont work. I keep getting messages saying that it must be IConvertible. I dont know what that means. If I populate the listbox at design time by hand with the collection property, it works perfect. This isnt what I want to do though because as I add more items to the database, the listbox collection needs to grow with it. My sql statements are working properly, I just neeed another push in the right direction. Again.

BTW, Im a Freshman now. Im stoked.:D :D ::D
 
Are you having problems with binding to the listbox initially or the subsequent call to use the selected item as a parameter to the next query?
 
I am having problems when trying to usr the listbox selecteditem as a parameter in the query. I can bind to the list box no problem. The column from the database appears fiine. When I select a name from the list box I want to use that slected item for a query with its results displayed in the datagrid. When the program is runnning it stops and I get the message about not being IConvertible.
 
IConvertible problem indicates there needs to be DataType Conversion.
something like

Convert.ToChar();
 
Back
Top