Click here to Skip to main content
15,906,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
rs.Open("select distinct prtynm from vprtywrk", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
i = 0
While Not rs.EOF
DataGridView2.RowCount = DataGridView2.RowCount + 1
DataGridView2.Item(0, i).Value = rs.Fields("prtynm").Value
rs.MoveNext()
i = i + 1
End While
rs.Close()

how to filter this ?
if i have one textbox and i enter some text in that. then grid will be filter based on that string in textbox
Posted

1 solution

VB
"select distinct prtynm from vprtywrk where prtynm = '" & textbox1.text & "'" 
- you can put where clause in this part referencing the field that like what i did. prtynm is the field in your database and textbox1 is the textbox that you are using to filter the records that will be shown on your datagrid

you can also try this one
VB
"select distinct prtynm from vprtywrk where prtynm like '%" & textbox1.text & "%'" 


Regards,

John
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900