Link to home
Start Free TrialLog in
Avatar of grouchyfd
grouchyfdFlag for United States of America

asked on

How do I bind a datagrid to a listbox selected item?

This is for VS2005.
I have one dataset created from a view created from 2 tables. I want the user to select a unit from the listbox and and then the datagridview will show what product is on that unit. I can do this by using a textbox.text property thru a button_click event where the user has to type in the actual unit name. I would like the listbox to show all the units when the form loads and the then the user to select the unit to show the list. I added the query, using @Unit as the variable in the query, FillByUnit.

CustomrerTableAdapter.FillByUnit(Dataset.Datatable, UnitNameListBox.SelectedItem)
This doesn't seem to work.

Thanks
Avatar of YZlat
YZlat
Flag of United States of America image

use DataView
Avatar of grouchyfd

ASKER

I don't understand. This is not a property of my listbox. Could you please explain a little more in depth?

Thanks
do you bind your DataGrid to a DataSet?
Yes I did.
ASKER CERTIFIED SOLUTION
Avatar of YZlat
YZlat
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Because I'm using a view instead of a table I should use the dataview. That should work because I don't want the user to be able to edit anything.