To Search a record in datagridview

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 72
Reputation: geetajlo is an unknown quantity at this point 
Solved Threads: 0
geetajlo geetajlo is offline Offline
Junior Poster in Training

Re: To Search a record in datagridview

 
0
  #11
Nov 6th, 2007
i want to search a particular rows in the datagrid..
for example Any columns containing the data the user want to type, i want only the the data to be selected


for ex the user may want to serach all female, then only the rows female will b selected
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 15
Reputation: Triss is an unknown quantity at this point 
Solved Threads: 1
Triss's Avatar
Triss Triss is offline Offline
Newbie Poster

Re: To Search a record in datagridview

 
0
  #12
Nov 6th, 2007
  1.  
  2. Private Function Find(ByVal StrSearchString As String) As Boolean
  3.  
  4. DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
  5.  
  6. Dim intcount As Integer = 0
  7. For Each Row As DataGridViewRow In DataGridView1.Rows
  8. If DataGridView1.Rows(intcount).Cells(0).Value.ToString = StrSearchString Then
  9. DataGridView1.Rows(intcount).Selected = True
  10. Find = True
  11. Exit Function
  12. End If
  13. intcount += 1
  14. Next Row
  15. Find = False
  16. End Function
Last edited by Triss; Nov 6th, 2007 at 10:26 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 645
Reputation: binoj_daniel is an unknown quantity at this point 
Solved Threads: 17
binoj_daniel's Avatar
binoj_daniel binoj_daniel is offline Offline
DaniWeb Expert

Re: To Search a record in datagridview

 
0
  #13
Nov 6th, 2007
I think the logic from Triss would do that. Let me know.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 72
Reputation: geetajlo is an unknown quantity at this point 
Solved Threads: 0
geetajlo geetajlo is offline Offline
Junior Poster in Training

To Search a record in datagridview

 
0
  #14
Nov 7th, 2007
Hey Friends but where should i put the private function find
coz am using a button with an input box..
And wat should i put in the button search ,coz, there is nothing there except the input box...
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 15
Reputation: Triss is an unknown quantity at this point 
Solved Threads: 1
Triss's Avatar
Triss Triss is offline Offline
Newbie Poster

Re: To Search a record in datagridview

 
0
  #15
Nov 7th, 2007
Copy paste code... open form designer drop a button and a textbox on it, double click button then enter...

Call Find(textbox1.text)

Done.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 72
Reputation: geetajlo is an unknown quantity at this point 
Solved Threads: 0
geetajlo geetajlo is offline Offline
Junior Poster in Training

Re: To Search a record in datagridview

 
0
  #16
Nov 7th, 2007
Hey Triss
the button search doesn't do anything whevever i click it...

y
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 15
Reputation: Triss is an unknown quantity at this point 
Solved Threads: 1
Triss's Avatar
Triss Triss is offline Offline
Newbie Poster

Re: To Search a record in datagridview

 
0
  #17
Nov 7th, 2007
  1.  
  2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3. Call Find(TextBox1.Text)
  4. End Sub
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 72
Reputation: geetajlo is an unknown quantity at this point 
Solved Threads: 0
geetajlo geetajlo is offline Offline
Junior Poster in Training

Re: To Search a record in datagridview

 
0
  #18
Nov 7th, 2007
hey i have already copy n paste the function on the form and put the code call find to the button but it doesn't works. i have enter something in the textbox 2 n then press the button but nothing happens.
Help Me plzzz
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 15
Reputation: Triss is an unknown quantity at this point 
Solved Threads: 1
Triss's Avatar
Triss Triss is offline Offline
Newbie Poster

Re: To Search a record in datagridview

 
0
  #19
Nov 7th, 2007
Attach the project I will have a look if you want.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 72
Reputation: geetajlo is an unknown quantity at this point 
Solved Threads: 0
geetajlo geetajlo is offline Offline
Junior Poster in Training

Re: To Search a record in datagridview

 
0
  #20
Nov 13th, 2007
Hi triss can u help me how can i search name that starts with the letter F in a datagridview.
For example if i type F in the inputbox i got every name started with the letter F.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC