Hello,
I have a problem with BindingSource.Find. I have a datagridview with the columns Klantnummer, Achternaam, Contactpersoon, Straatnaam, Plaats, Telefoon and Mobiel. I want to find a row with the Bindingsource.find method. Above the datagridview i have a combobox to select the column and a textbox where I can type the text I want to find.
It works fine for one column. I only can find something in the Klantnummer column. When I select an other column in the combobox it finds nothing.
This is the code I am using:
Private Sub ToolStripTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripTextBox1.TextChanged
If Me.toolstripcombobox1.Text = "Klantnummer" Then
Dim gevonden As Integer = Me.KlantBindingSource.Find("Klantnummer", Me.ToolStripTextBox1.Text)
Me.KlantBindingSource.Position = gevonden
ElseIf Me.toolstripcombobox1.Text = "Achternaam" Then
Dim gevonden As Integer = Me.KlantBindingSource.Find("Achternaam", Me.ToolStripTextBox1.Text)
Me.KlantBindingSource.Position = gevonden
ElseIf Me.toolstripcombobox1.Text = "Contactpersoon" Then
Dim gevonden As Integer = Me.KlantBindingSource.Find("Contactpersoon", Me.ToolStripTextBox1.Text)
Me.KlantBindingSource.Position = gevonden
ElseIf Me.toolstripcombobox1.Text = "Straatnaam" Then
Dim gevonden As Integer = Me.KlantBindingSource.Find("Straatnaam", Me.ToolStripTextBox1.Text)
Me.KlantBindingSource.Position = gevonden
ElseIf Me.toolstripcombobox1.Text = "Plaats" Then
Dim gevonden As Integer = Me.KlantBindingSource.Find("Plaats", Me.ToolStripTextBox1.Text)
Me.KlantBindingSource.Position = gevonden
ElseIf Me.toolstripcombobox1.Text = "Telefoon" Then
Dim gevonden As Integer = Me.KlantBindingSource.Find("Telefoon", Me.ToolStripTextBox1.Text)
Me.KlantBindingSource.Position = gevonden
ElseIf Me.ToolStripComboBox1.Text = "Mobiel" Then
Dim gevonden As Integer = Me.KlantBindingSource.Find("Mobiel", Me.ToolStripTextBox1.Text)
Me.KlantBindingSource.Position = gevonden
End If
End Sub