Filtering a DataGridView
Visual Basic 2005:
I have a DataGridView in Last Name sequence.
Is it possible to when a user types the first letter of a last name
that it displays all rows with last names that start with that letter.
When he types the second letter, it displays all records whose last name starts with those 2 letters, etc.?
[357 byte] By [
furjaw] at [2007-11-20 11:54:29]

# 1 Re: Filtering a DataGridView
Hello again! I just answered your question at another forum. Small world, eh? :)
# 3 Re: Filtering a DataGridView
Not a criticism, just a comment. Ask in as many places as you can, but don't forget to mark your thread resolved in each place once you have an answer.
# 5 Re: Filtering a DataGridView
Private Sub LastNameTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LastNameTextBox.TextChanged
PatientBindingSource.Filter = "LastName Like '" & LastNameTextBox.Text & "*'"
End Sub
furjaw at 2007-11-10 3:12:16 >

# 6 Re: Filtering a DataGridView
My original code solution would have translated to:Private Sub LastNameTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LastNameTextBox.TextChanged
Me.PatientBindingSource.Filter = String.Format("LastName LIKE '{0}%'", Me.LastNameTextBox.Text)
End Subwhich I prefer.