Hi All,

I am trying to do a search on a index/row number taken from a dataview i.e. I enter 379437 in the input box which I know has a index/row number of 6.

Now when I replace the Rows(index) with a Rows(6) I get the results that I want.

When I run the code below the index comes out as 75 which displays the first row from the dataset which is a completely different set of results.

Private Sub ButFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButFind.Click

        Dim SWTrioleNo As String

        SWTrioleNo = InputBox("Enter Triole Number:")

        dv = New DataView(ds.Tables("Tracker"))
        dv.Sort = "TrioleNo"
        Dim index As Integer = dv.Find(SWTrioleNo)

        TxtTriole.Text = ds.Tables("Tracker").Rows(index).Item(1).ToString
        DateOpen.Text = ds.Tables("Tracker").Rows(index).Item(2).ToString
        ComboBoxDesc.Text = ds.Tables("Tracker").Rows(index).Item(3).ToString
        TxtQty.Text = ds.Tables("Tracker").Rows(index).Item(4).ToString
        TxtPrice.Text = ds.Tables("Tracker").Rows(index).Item(5).ToString
        TxtCostCenter.Text = ds.Tables("Tracker").Rows(index).Item(6).ToString
        TxtGatekeeper.Text = ds.Tables("Tracker").Rows(index).Item(7).ToString
        TxtUser.Text = ds.Tables("Tracker").Rows(index).Item(8).ToString
        TxtID.Text = ds.Tables("Tracker").Rows(index).Item(9).ToString
        DateOrder.Text = ds.Tables("Tracker").Rows(index).Item(10).ToString
        CBStatus.Text = ds.Tables("Tracker").Rows(index).Item(11).ToString
        CBNext.Text = ds.Tables("Tracker").Rows(index).Item(12).ToString
        DateNextAction.Text = ds.Tables("Tracker").Rows(index).Item(13).ToString
        CBChase.Text = ds.Tables("Tracker").Rows(index).Item(14).ToString
        DateDelivery.Text = ds.Tables("Tracker").Rows(index).Item(15).ToString
        CBStrike.Text = ds.Tables("Tracker").Rows(index).Item(16).ToString
        TxtNotes.Text = ds.Tables("Tracker").Rows(index).Item(17).ToString

End Sub

Any help to resolve this would be greatly appreciated.

From first glance you created a DataView from the table and then you sorted it. The row order in the dataview will not match the row order in the original table. So you are searching the dataview for the Index only to use the index with the original table. Why not search the DataView?

Do the following creating your dataview and kill 2 birds with one stone.

Dim dv As New DataView(Datatable Name, "ID = " & Cstr(Index), "Sort Column", DataViewRowState.CurrentRows)

"Sort Column" = Column Name you want to sort by.

Then you can get the values for your TextBoxes
by iterating the columns of the row returned

TextBox1.Text = CStr(dv(0)("Columnx"))
TextBox2.Text = cstr(dv(0) ("Columnx"))

Columnx = Column Name from your table

Seems like you only want one row from the Table to fill your textboxes.