OK here is some code we made up. We created a While loop to find the
recordnumber in the table. All this to set the pointer to the right
item. Not a very fast method when a table gets large as it will. The
current procedure needs to to scroll through every time we lookup a
number. So how can we do better. We understand it is best NOT to use
recordnumbers. So we gave every record a unique indexnumber and set
the key to that but somehow we cant set the pointer to that indexkey
in the table.
English is not our native language as is VB yet! Hope any of you can
help us.
Me.BindingContext(DsNewsTitle1, "IsDsNewsTitle").Position =
SearchNews(DsNewsRoomTemp1, DsNewsTitle1, "IsDsNewsRoom",
"IsDsNewsTitle", "ID_IsDsNewsTitle", "Subject", 5)
Function SearchNews(ByVal cDataSetRoot, ByVal cDataSetSearch, ByVal
cRootTable, ByVal cSearchTable, ByVal cSearchKey, ByVal cField, ByVal
nField)
Dim nEnd As Integer = Me.BindingContext(cDataSetSearch,
cSearchTable).Count
Dim cFound As String =
(cDataSetRoot.Tables(cRootTable).Rows(FormNews.nTableNewsRoom -
1)(cSearchKey)).ToString
Dim cFoundRow As DataRow =
cDataSetSearch.Tables(cSearchTable).Rows.Find(cFound)
Dim nRecord As Integer = 0
If Not (cFoundRow Is Nothing) Then
Do While nRecord < nEnd
If
cDataSetSearch.Tables(cSearchTable).Rows(nRecord)(cField) =
cFoundRow(nField) Then Exit Do
nRecord += 1
Loop
If nRecord = nEnd Then Return 0
Return nRecord
End If
End Function