CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Location
    Tenby, Wales
    Posts
    277

    Stopping user being able to type into ComboBox

    Is there any way I can stop users being able to type into a ComboBox?

    The reason is that I have a set list of things in the ComboBox and I only want the user to be able to save 1 of those specific things into the Database upon saving. I don't want them to have the ability to add anything else.

    I have tried locking it but that stops them being able to select anything!

    Thanks in abvance

  2. #2
    Join Date
    Aug 2006
    Posts
    145

    Re: Stopping user being able to type into ComboBox

    set the ComboBox's style to 2 - DropDown List

  3. #3
    Join Date
    Mar 2007
    Location
    Pakistan
    Posts
    13

    Re: Stopping user being able to type into ComboBox

    Hi,
    You can change the style property of the combo box to 2-Dropdown List from the property window.

    or in the form_load event write:
    combo1.style=2

    or if you don't want to change the style of the combo, write the following code in the keypress event of the combo box.

    Keyascii=0

  4. #4
    Join Date
    Dec 2002
    Location
    Tenby, Wales
    Posts
    277

    Re: Stopping user being able to type into ComboBox

    OMG . . . I can't believe how thick I am sometimes! I have used that style loads of times

    Thanks for that

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

Featured