Results 1 to 9 of 9

Thread: [RESOLVED] listbox items = text

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    145

    Resolved [RESOLVED] listbox items = text

    is there a way to check whether any of the listboxes items = a string, say from a textbox? thanks

  2. #2
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: listbox items = text

    listbox.selecteditem.text = textbox.text

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    145

    Re: listbox items = text

    i mean like any of them from the whole list not just the selected item

  4. #4
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: listbox items = text

    try something like this:
    vb Code:
    1. for i =0 to listbox.items.count
    2.    if listbox.items(i).text = textbox.text then
    3.      'do something
    4.    end if
    5. next

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    145

    Re: listbox items = text

    ok thanks a lot

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: listbox items = text

    Use ListBox1.Items.FindByText() or .FindByValue().

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    145

    Re: listbox items = text

    thanks thats even easier!!

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: listbox items = text

    add [resolved] dude.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    145

    Re: listbox items = text

    yep difinately resolved!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width