Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
VB.NET
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
    Dim DV As New DataView(ED_dataDataSet27.Users)
    DV.RowFilter = String.Format("User name Like '%{0}%'", TextBox6.Text)
    DataGridView3.DataSource = DV
End Sub


What I have tried:

I tried to change to |" DV.RowFilter = String.Format("Password Like '%{0}%'", TextBox6.Text) " | and it worked but when I change from Password to User name, this error come up | "Syntax error: Missing operand after 'i' operator vb.net" |
Posted
Updated 10-Apr-16 3:22am

1 solution

It's the space in your name.
Try this:
VB
DV.RowFilter = String.Format("[User name] Like '%{0}%'", TextBox6.Text)

BTW: Do yourself a favour, and stop using Visual Studio default names for everything - you may remember that "TextBox6" is the user name today, but when you have to modify it in three weeks time, will you then? Use descriptive names - "tbUserName" for example - and your code becomes easier to read, more self documenting, easier to maintain - and surprisingly quicker to code because Intellisense can get to to "tbUserName" in three keystrokes, where "TextBox6" takes thinking about and 8 keystrokes...
 
Share this answer
 
Comments
ionMEMBER 10-Apr-16 10:11am    
thanks! :)
OriginalGriff 10-Apr-16 10:21am    
You're welcome!

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