How do I restrict combobox entries to the collections list?

Posted on 2007-10-03
Last Modified: 2013-12-26
This seems so trivial, but...
I thought the whole point to a combobox was to restrict selection by a user to entries that appear in the Items collections list. Why is it, then, that I can type something else directly into the combobox, and VB.NET accepts it? Am I missing setting some property? I'm using the standard ComboBox from Windows Forms.
Question by:jdallen75
    1 Comment
    LVL 53

    Accepted Solution

    The easiest solution:
    Set the following property of your combobox:
    Dropdownstyle: Dropdownlist

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now