I had a datagridview which contains all the last name of a certain
database.the data was displaying properly .I want to accomplished two
tasks,first I want it that upon loading on the datagrid, data are
sorted alphabetically already even without pressing the column
header.Second I want to search the datagrid using a text box. I want
like an autocomplete manner, if I type a single letter, say "B", the
datagridcolumn will automatically point to the the name say "Bal" and
so on...thanks once again.

searching in datagridview using textbox
Ying Fa
Rockdrala
claudioe
MVP User
If you have a bindingsource, i'd use the following:
Bindingsource.find returns an integer (row number) of the matching record
Try
Dim x As Integer = Me.CustomersBindingSource.Find("ColumnName", TextBox.Text) Me.CustomersBindingSource.Position = x Catch ex As ExceptionMsgBox(
"Search Value not Found") End TryIts pretty simple :)
pEri
- Bind your DataGridView to a DataView (instead of a DataTable).
- On Form.Load(), set your DataView.Sort property to the desired sort.
- On TextBox.TextChanged(), set your DataView.RowFilter property to something like this: String.Format("ColumnName LIKE '{0}%'", TextBox.Text).
Hope that helps,Joe Morel - MSFT
dv.sort="FirstName"
dim intRowNum as integer
intRowNum=dv.find("Joe")
' Now we need to move to the right row
MyBindingNavigator.BindingContext.Postion = intRowNum
Greg1970
dv.Sort="MyColumnNameToSort"
ScottW1