What I have essentially done is created a "TopMost" search form ( standard MS find & replace ) that allows an input of text. When the search button is pressed a delegated method in the calling form is called and uses the dataset "Find" method to locate the text in the dataset. The calling form contains databound controls in conjunction with the CurrencyManager which refreshes the controls whenever a "PREVIOUS" or "NEXT" button is pressed i.e. navigating through the dataset.
However, when I call the find method ( code below ) I cannot obtain a correct record pointer index i.e. find out the row that was successfully found and then refresh the controls with the data from the found row. I would have expected the "position" property to be equal to the row that was found, but it is not.
Public Sub Find(ByVal tcField As String, ByVal tcValue As String)
Dim colArray(1) As DataColumn
colArray(0) = objDS.Tables(0).Columns(tcField)
objDS.Tables(0).PrimaryKey = colArray
Dim FoundRow As DataRow = objDS.Tables(0).Rows.Find(tcValue)
If FoundRow Is Nothing = False Then
MsgBox(Me.BindingContext(Me.DataSet.Tables(0)).Position)
Me.Refresh()
End If
End Sub
Many thanks,
Glyn.
However, when I call the find method ( code below ) I cannot obtain a correct record pointer index i.e. find out the row that was successfully found and then refresh the controls with the data from the found row. I would have expected the "position" property to be equal to the row that was found, but it is not.
Public Sub Find(ByVal tcField As String, ByVal tcValue As String)
Dim colArray(1) As DataColumn
colArray(0) = objDS.Tables(0).Columns(tcField)
objDS.Tables(0).PrimaryKey = colArray
Dim FoundRow As DataRow = objDS.Tables(0).Rows.Find(tcValue)
If FoundRow Is Nothing = False Then
MsgBox(Me.BindingContext(Me.DataSet.Tables(0)).Position)
Me.Refresh()
End If
End Sub
Many thanks,
Glyn.