I’ve created a form that contains a datagridview and I’ve attached a datasource, works well if I want to see every record but I only want it to show a certain persons view, I found some code that people claim works but when I run the program I get an syntax error…
Syntax error: Missing operand after ‘number’ operator.
SO has helped me a lot in the past since I’m new to programming, and if I may ask can you guys help me one again?
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) _
Handles TextBox1.TextChanged
If TextBox1.TextLength > 0 Then
frmReportMenu.ProjectBindingSource.Filter = _
String.Format("Register number Like '%" & TextBox1.Text) & "%'"
Else
frmReportMenu.ProjectBindingSource.Filter = String.Empty
End If
End Sub
I’ve created a button when the user clicks on the button a form appears with a textbox
I assume the column name is what is giving you the error. As per my comment,
It shouldn’t contain a space between
RegisterandNumber. If it has a space then you have to wrapt the column name like this:[Register number]Try this please:
String.Format("[Register number] Like '%" & TextBox1.Text) & "%'"