Results 1 to 9 of 9

Thread: Stop user typing to combo

  1. #1
    Guest
    How do I stop users typing into text of the combo box?
    I need the following:

    When the form is opened, the list will be loaded in the combo which is sorted and combo.text should be the same as the first item of the list. (THIS WORKS OK)

    The user should only be able to choose one of the items from the list. The user should not be able to type or paste text into combo.text. (THIS IS WHERE I HAVE GOT A PROBLEM)

    Thanks.

















  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Set the locked propery of the combo box to true.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest

    "Locked" property not good...

    If I set the locked property to true, then I cannot choose another entry by clicking at the list, so this is not good.

    Any other ideas?

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Set the style to Dropdown List

  5. #5
    Guest

    NOT WORKING :(((

    I could not get it to work with both suggestions. To see what is my problem, create a new form with the Combo1 control. Set the properties of Combo1 as Locked = True and Style = 0 - Dropdown Combo.

    Paste the following lines in the form:


    Private Sub Form_Load()

    Combo1.Text = "First Choice"
    Combo1.AddItem "First Choice"
    Combo1.AddItem "Second Choice"
    Combo1.AddItem "Third Choice"
    Combo1.AddItem "Fourth Choice"
    End Sub

    Now run the program. Click on combo, the drop down list appears. Try to click on the entry of the list - impossible.




  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    The text they enter is only for finding purposes.
    It helps the user find their choice easier.

    Ie. if you type in T then Third Choice comes to the
    front.

    Combo1.AddItem "First Choice"
    Combo1.AddItem "Second Choice"
    Combo1.AddItem "Third Choice"
    Combo1.AddItem "Fourth Choice"
    'instead of this
    'Combo1.Text = "First Choice"
    'try this

    Combo1.ListIndex = 0
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7
    Guest
    Set the dropdown style to 2.

  8. #8
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Forgot to mention that. I have it set to 2.

    However, that does not prevent the user typing info
    but as I said it is only for finding not retaining.

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  9. #9
    Guest
    Thanks, guys, that has sorted it.


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