Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to use combobox in C#

Posted on 2009-02-10
1
Medium Priority
?
1,946 Views
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)
X = IPADD;


How do i do that?
Thanks for your help.
Tony

0
Comment
Question by:JesuSingarayar
1 Comment
 
LVL 5

Accepted Solution

by:
rendaduiyan earned 1000 total points
ID: 23608029
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;
            }
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

575 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