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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

do you bind your DataGrid to a DataSet?
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

grouchyfdAuthor Commented:
Yes I did.
create a dataview based on your dataset:

Dim dv As New DataView(ds.Tables(0))

and then bind your datagrid to a dataview instead of a dataset.

Then you can ser RowFilter property of your dataview to whatever value user selects from  ListBox

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
grouchyfdAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.