944,155 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 31458
  • VB.NET RSS
Nov 6th, 2007
-1

Filtering a DataGridView

Expand Post »
Visual Basic.Net:

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.?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
furjaw is offline Offline
23 posts
since Mar 2006
Nov 6th, 2007
-1

Re: Filtering a DataGridView

This is pretty much doable and this functionality is called AutoComplete is Web Platform and Incremental Search in WinForms Arena.
Reputation Points: 25
Solved Threads: 18
Practically a Master Poster
binoj_daniel is offline Offline
645 posts
since Dec 2006
Nov 6th, 2007
0

Re: Filtering a DataGridView

It works great!!!
Below is the code that I ended up with:

If LastNameTextBox.TextLength > 0 Then
PatientBindingSource.Filter = String.Format("LastName Like '" & LastNameTextBox.Text) & "*'"
Else
PatientBindingSource.Filter = String.Empty
End If
Reputation Points: 10
Solved Threads: 0
Newbie Poster
furjaw is offline Offline
23 posts
since Mar 2006
Nov 6th, 2007
0

Re: Filtering a DataGridView

What event of the textbox did you use?
Reputation Points: 25
Solved Threads: 18
Practically a Master Poster
binoj_daniel is offline Offline
645 posts
since Dec 2006
Nov 6th, 2007
0

Re: Filtering a DataGridView

Private Sub LastNameTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LastNameTextBox.TextChanged
Reputation Points: 10
Solved Threads: 0
Newbie Poster
furjaw is offline Offline
23 posts
since Mar 2006
Nov 6th, 2007
0

Re: Filtering a DataGridView

Thats good, glad you solved it. you can read more .net articles & best professional best practices here
Reputation Points: 25
Solved Threads: 18
Practically a Master Poster
binoj_daniel is offline Offline
645 posts
since Dec 2006
Dec 4th, 2008
0

Re: Filtering a DataGridView

Hi guys, there is an example of code posted of exactly that you want to do (it evens uses the First Name field and does "on the fly data filtering" based on filter condition)

You may see it in action here:

Dynamic filtering DataGridView in C#
http://www.dotneat.net/2008/12/03/Dy...teringInC.aspx

(Windows Forms and C#)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iloire is offline Offline
1 posts
since Dec 2008
Mar 20th, 2010
0
Re: Filtering a DataGridView
hi, there.. i try used your code, but it doesn't help...


If LastNameTextBox.TextLength > 0 Then
PatientBindingSource.Filter = String.Format(
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iedapRo is offline Offline
1 posts
since Mar 2010
Mar 20th, 2010
0
Re: Filtering a DataGridView
Hi iedapRo.

This thread is almost three yeard old. If you want to ask question, start your own (new) thread. Please read daniweb member rule and http://www.daniweb.com/forums/thread78223.html

Thread Closed.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in VB.NET Forum Timeline: crystal reports
Next Thread in VB.NET Forum Timeline: how can i insert date day and time on status strip m using vb 2005





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC