Read pointer in listbox or combibox

  • Thread starter Martin Heuckeroth
  • Start date
M

Martin Heuckeroth

Hi,

How can we set and read the pointer in a listbox or a combibox to the
found search. We use the datarow function with SQL2000 and VB.NET.

Hope anyone can help

Regards, Martin
 
J

Jeff Johnson [MVP: VB]

How can we set and read the pointer in a listbox or a combibox to the
found search. We use the datarow function with SQL2000 and VB.NET.

Hope anyone can help

Some folks may take a guess, but I recommend that you give a little more
detail. I for one don't really understand what you're trying to do. Some
sample code of what you've already tried would be helpful, too.
 
M

Martin Heuckeroth

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top