VB 6.0 - WordWheel required

Hello there,

could anyone help me with some VB 6 code
for a wordwheel. eg. I need to be able to check for names in a list, where the highlight will jump to the first matching name in alphabetical order ...

10x
jarrod100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
"HOWTO: Search a ListBox Control Quickly"

http://support.microsoft.com/support/kb/articles/q161/1/61.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
runner75Commented:
Jarrod100,

for this example create a form:
- and add 1 TextBox (named: s_box) ... search box
- and add 1 ListBox  (named: Dictionary) ... where all your names will reside (populate this from a DB)

in your code : General/Declarations paste the following code:

========> cut here <==============

Private Sub s_box_KeyUp(KeyCode As Integer, Shift As Integer)

Dim cntr1 As Integer 'counter 1
Dim cntr2 As Integer 'counter 2
Dim n_str As String 'new string

' perform the search
n_str = s_box.Text
For cntr1 = 0 To Dictionary.ListCount - 1)
If Len(n_str) <= Len(Dictionary.List(cntr1)) Then
If UCase(Left(n_str, Len(n_str))) = _
            UCase(Left(Dictionary.List(cntr1), Len(n_str))) And _
Len(n_str) <> 0 Then
  Dictionary.Selected(cntr1) = True
  cntr1 = Dictionary.ListCount - 1
End If
Else
If cntr1 < Dictionary.ListCount - 1 Then
   cntr1 = cntr1 + 1
End If
End If
Next cntr1

End Sub

========> cut here <==============

Hope this helps,
runner75
0
jarrod100Author Commented:
10x guys,

   both codes seem to work fine:
    - Erick37s' code is shorter :)
    - runner75's code helps me
      understand how the search
      is accomplished.

   you both deserve 100 points,
   however this time Erick37 was
   first :)

10x Erick37

   
0
Erick37Commented:
Glad to help.  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.