Ok, I've got 2 problems solved, (Thanks to Kainsworth, without who's help I wouldn't be this far !!), but here's my problem... I have the following:
Database name "Birdkeeper"
Table name "gentest"
OleDbConnection1
OleDbDataAdapter1
objDataSet1
DataView named "dvgentest"
Module with the following:
Friend f1 as DataForm1
Friend fs1 as frmsearch1
Friend dv as DataView
Friend ds1 as DataSet1
Fields named "Band", "Breed", and "Club"
there are 9 fields but was using these to get it working and add the others later.
Here is my code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dvgentest As New DataView(ds1.Tables_("gentest"), "", "Band, Breed, Club", DataViewRowState.CurrentRows)
Dim foundRows() As DataRowView = dvgentest.FindRows(New Object_() {"TextBox1.Text"})
If foundRows.Length = 0 Then
Console.WriteLine("No match found.")
Else
Dim myDRV As DataRowView
For Each myDRV In foundRows
Console.WriteLine("{0}, {1}, {2}", myDRV_("Band").ToString(), myDRV("Breed").ToString(), myDRV("Club").ToString())
Next
End If
Me.Close()
End Sub
I am trying to use a textbox on a search form to find any records that match the textbox and display them on the datagrid on the bottom form.
I have been able to do this using a specific field in the search (Thanx Ged !!), but when I try to use the above code to find any field, I get the following: "Object reference not set to an instance of an object". In reading the material that was recommended to me (Thanx again Ged !), the above seems to be the way to go but I know I'm making a stupid error somewhere and am not sure what the error code is trying to tell me. I have my DataView "ApplyDefaultSort" set to "True".
Any help would be greatly appreciated.
Bill