search datagridview

lional

Member
Joined
Apr 10, 2012
Messages
16
Programming Experience
Beginner
Hi.

I have a datagridview that I have allowed the columns to be sorted by clicking on teh column.
is it possible that after clicking on a calumn to type in for eg. the start of a surname and it then goes to that record

Thanks

Lional
 
How is the grid populated? If the data is coming from a database then you should populate a DataTable and bind it to a BindingSource, then bind that to the grid. You search using the Find method of the BindingSource. That will return the index of the matching item and you assign that to the BindingSource's Position property, which will automatically select that row in the grid.
 
The grid is populated from a DB. I have multiple columns and what I want is that if you click on a column it then sorts by that column. so whatever is typed on the keyboard will then go to the record in that specific column. I am very new to VB learning it from books but as usual the books are very limited when it comes to the data section. Is there a tutirial that would show me how to use the Find method and do what I want to achieve.
 
Is there a tutirial that would show me how to use the Find method and do what I want to achieve.

Quite possibly, but I don't keep a link on me. To find one I would have to use a search engine, which you can do just as easily. As is always the case, you should start by reading the MSDN documentation. If that doesn't give you enough information, then search for examples, etc.
 
I am battling with this a bit. Is there not any sample code that I can look at to try and get an understanding.
 
I am battling with this a bit. Is there not any sample code that I can look at to try and get an understanding.
I'm sure there is but it's not going to find you. You have to find it. You don't need any programming experience to search the web.
 
Back
Top