• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 698
  • Last Modified:

how to limit combobox to items in the list

Hi Everyone,

In a VB.NET 2005 windows application

In a combobox, I need to reject the entry if the user type/pick something different that the list.

How can I limit the user to input only items form the list?

TIA

Jorge

0
George
Asked:
George
  • 4
  • 3
1 Solution
 
Jorge PaulinoIT Pro/DeveloperCommented:
You can change the DropDownStyle to DropDownList
Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

Open in new window

0
 
GeorgeAuthor Commented:
Hi JPaulino

Thank you for your response,

For some reason is not preventing form inputting any value that I want, despite that the property  DropDownStyle is selected to  DropDownList

Is there any other setting that I have to adjust?

TIA
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
You can use the keys to jump to some item but you cannot write a new one, right ?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
GeorgeAuthor Commented:
Ok I placed the

Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

in the event Enter of the DropDown and now is working .... , but The problem is that I need the autocomplete....
   
     cmbCommunity.AutoCompleteMode = AutoCompleteMode.SuggestAppend
     cmbCommunity.AutoCompleteSource = AutoCompleteSource.ListItems

Is there a way to have both functionalites ? limit to list and aswell autocomplete?

TIA
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
How do you define the itens for the combobox ?
0
 
GeorgeAuthor Commented:
Thank you very much, the examples gave the ideas on how to make it work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now