Error in binding data after filtering

Jan 12 2009 2:22 AM

Hello,

I am trying to make a small application and I have a problem in binding data after filtering them.

I use VB 2005 and SQL 2005. The data are shown in datagridview and I bind the selected row to the text boxes of the form. eg.

Private Sub BindingTexttoDs()

        Me.BindingContext(DS.Tables(0)).Position = CarDataGridView.CurrentRow.Index
        txtPlatesNo.DataBindings.Add("text", DS.Tables(0), "PlatesNo")
        txtOwner.DataBindings.Add("text", DS.Tables(0), "OwnerCode")
        txtBrand.DataBindings.Add("text", DS.Tables(0), "Brand")
        txtModel.DataBindings.Add("text", DS.Tables(0), "Model")
        txtNotes.DataBindings.Add("text", DS.Tables(0), "Notes")
 
Later on I search the data for some records and at the same time I remove the databinding. When I try to bind them again it does not work because the index is from the whole data and not the filter data.
I have fixed the problem in another situation where I had autonumberin as a primary key and I used this as an index.
In this case I use platesno as an index and it's not working.
I try to solve it but I cannot make it work.
Can you help me please?
Thanks in advance.