i have a datagridview called 'gvStudents' that shows typical student info. I'm fairly new to VB.net and would like some clarity on how to search a datagridview by typing in a textbox.
As the user types in the textbox the results are shown in the datagridview to the closest match.
My gvStudents extracts info from my SQL 2005 database using a stored procedure. Ive connected to the database with a manual connection.
instead of making the textbox search the database using stored procedure i would like to extract the datagridview into a datatable (not sure if that makes sense) and run the search.
the code i'm trying to use and dont really understand to be fair is:
Expand|Select|Wrap|Line Numbers
- Dim dt As Table = Ctype(gvStudents.datasource,datatable)
- for each row As datarow In dt.row Next
- if datarow.item("username.string.contains.Me.textbox.text)
- datarow.visible = false
sorry if my question or explanation is confusing.
Many thanks