Results 1 to 3 of 3

Thread: Compare Textbox with Listbox

  1. #1

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Mettmann, Germany


    In my programm, there is a listbox in which different
    numbers are added (001 025 027 145..).
    Then tere's a text-box in which different numbers are
    printed. Now I want that a message comes up, if this number
    exists already in the listbox (Visible = false). But the
    problem is, that this Listbox must have a focus and only
    marked items are working like I want.
    Yet I use this: ____ INP2 = textbox L4 =List
    If INP2.Text = L4 Then MsgBox "Number exists!!"
    Is it possible that I can compare the textbox
    with all the items in the listbox, without using a focus
    and without marking an item in the listbox ?

    [i] I hope, you understood my problem,
    thanx for some tips, Matt-D(eutschland)

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Do you really need to have the listbox, is it always invisible? Yes it's possible to compare each item, just loop from 0 to listcount-1. Use if Selected(index) to check if it's selected or not.
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    You can use the List property.
    Dim X As Integer
    For X = 0 To L4.ListCount - 1
        If INP2.Text = L4.List(X) Then
            Call MsgBox("Number exists!", vbInformation)
            Exit For
        End If

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