How to use combobox in C#

Posted on 2009-02-10
Last Modified: 2013-12-14
Hi experts,
I am beginner, i want to use combobox in C# application.I just want to choose a single item from a combobox list and assign it to a variable X...

Say for example
If(item in the list is IPADD)

How do i do that?
Thanks for your help.

Question by:JesuSingarayar
    1 Comment
    LVL 5

    Accepted Solution

    1) ComboBox is different from listbox, you can only choose one item;
    2) if you want get the select item you need to add a handler to IndexChaged event; something like this:
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
                if (-1 != this.comboBox1.SelectedIndex)
                    ListItem oItem = (ListItem)this.comboBox1.SelectedItem;
                    //this.comboBox1.Text = oItem.Text;

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now