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

To Search a record in datagridview

 
0
  #1
Nov 4th, 2007
hi friends...
i want to search a record from a datagridview with an input box...
Can anyone help me plz...
It's 4 my project ...
Need help plzzzz...
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
  #2
Nov 4th, 2007
So you need to type the parameter in a input box to filter the Grid?
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
  #3
Nov 4th, 2007
Are you using VS 2003 or VS 2005?

Database SQL or Access?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1
Reputation: vcombstlh is an unknown quantity at this point 
Solved Threads: 0
vcombstlh vcombstlh is offline Offline
Newbie Poster

Re: To Search a record in datagridview

 
0
  #4
Nov 4th, 2007
Originally Posted by geetajlo View Post
hi friends...
i want to search a record from a datagridview with an input box...
Can anyone help me plz...
It's 4 my project ...
Need help plzzzz...
Ok, what's the problem? Assume you want your users to enter a term in a textbox then you will search for that term. Is that correct? Give a little more info on the issue and what you need.
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
  #5
Nov 5th, 2007
VS 2005 et database Access
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
  #6
Nov 5th, 2007
You could loop through the rows in the datagridview ? Or maybe re-query the datasource?

Dim intcount As Integer = 0
For Each Row As DataGridViewRow In DataGridView1.Rows
If DataGridView1.Rows(intcount).Cells(0).Value = "StringSearch" Then
'Do Something
intcount +=1
End If
Next Row
Last edited by Triss; Nov 5th, 2007 at 4:41 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
  #7
Nov 5th, 2007
Do you want to search a particuar column from the DB or just any text in the Grid?
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
  #8
Nov 5th, 2007
Text in the grid... I think they mean... ?
Last edited by Triss; Nov 5th, 2007 at 11:01 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
  #9
Nov 5th, 2007
You Can use something like this using DataView

Dim dv As New DataView(ds.Tables(0))
dv.RowFilter = "FirstName = '" & TextBox1.Text & "'"
DataGrid1.DataSource = dv

You can replace the Textbox2.text to the value returned from the inputbox.
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
  #10
Nov 6th, 2007
hi thanks it works...
the search works, it select only the fullrows containing the firstname i type in the input box but all the other data disappear.
i don't want it to disapppear, i want it to be in the datagrid..
help me plz
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