I have a form that opens with a bindingsource on it and I want to set it to a particular record. In the form, I have the following:
Public Sub New(ByVal idNum As Integer) InitializeComponent() Debug.WriteLine("ID passed = " & idNum) Dim row As Integer row = CustomerTBLBindingSource.Find("CustomerID", row) Debug.WriteLine("Index=" & row) If row <> -1 Then CustomerTBLBindingSource.Position = row End If
I can't get the find to work for the life of me! The table has 3 records with CustomerIDs of 1,2 and 3. The field is set to the primary key with a value of int. I even tried:
Where one of the records has Bob for the LastName, but it always returns an index of -1. I have found all kinds of examples identical to this and they seem to work for everyone else. Any ideas what's wrong or how I can debug it?
Open in new window
Works like a charm!