Searching a string and find a string name

This is VB3 code that was posted for me from Leahcim, and I got the main idea, but I don't understand the 3rd line in it, I have VB5, so any translations would be appreciated




For I = 0 to List1.ListCount - 1

If Instr(List1.List(I), YourWord) > 0 Then

Text1.Text = (or List2.AddItem) List1.List(I)

Exit For 'Remove line if you want it to find every entry that matches

End If

Next I


Thanks,

Matthew


Comments

  • I believe that the line meant (in English): "Set the textbox (or add an entry in another listbox) to the List1 entry currently being reviewed".


    : This is VB3 code that was posted for me from Leahcim, and I got the main idea, but I don't understand the 3rd line in it, I have VB5, so any translations would be appreciated


    :

    : For I = 0 to List1.ListCount - 1

    : If Instr(List1.List(I), YourWord) > 0 Then

    : Text1.Text = (or List2.AddItem) List1.List(I)

    : Exit For 'Remove line if you want it to find every entry that matches

    : End If

    : Next I


    : Thanks,

    : Matthew





  • : Text1.Text = (or List2.AddItem) List1.List(I)


    Sorry, what I meant was either:


    Text1.Text = List1.List(I)


    Or


    List2.AddItem List1.List(I)


    I wasn't sure from your original message whether you wanted the entry added to a listbox or a textbox, so I did both. Sorry, I shortcutted it instead of making it clearer.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories