locked
Disable Typing in a Combo Box?

    Question

  • This isn't specifically a VB issue (or is it?). I was wondering how to disable a user from typing into a combo box. I wish for them to only be able to select items listed already. I looked through the properties but couldn't find any obvious solution.

    Cheers, x

    Tuesday, June 05, 2007 8:32 AM

Answers

  • Salaam,

    You can set the property "DropDownStyle" to "DropDownList"

    for example

     if you have a combobox to show countries called "comCountry" , then

     

    Code Snippet

    comCountry.DropDownStyle=ComboBoxStyle.DropDownList

     

    and by this , you obliged the user to select an item from it , and the user can't write in the combobox text

     

    regards

    Tuesday, June 05, 2007 8:41 AM

All replies

  • Salaam,

    You can set the property "DropDownStyle" to "DropDownList"

    for example

     if you have a combobox to show countries called "comCountry" , then

     

    Code Snippet

    comCountry.DropDownStyle=ComboBoxStyle.DropDownList

     

    and by this , you obliged the user to select an item from it , and the user can't write in the combobox text

     

    regards

    Tuesday, June 05, 2007 8:41 AM
  • Thankyou very much, that worked perfectly =).
    Tuesday, June 05, 2007 9:11 AM