Solved

Clearing the selection in a Winform Combobox of type: DropDownList

Posted on 2007-11-29
2
893 Views
Last Modified: 2008-09-12
Hi:

I'm using a Combobox in .Net 2.0 winforms. The DropdownStyle for the combobox is set to DropDownList. When the combobox first displays, the edit portion shows a blank (indetermanite state).
I would like to programmatically reset this property so it's back to the indetermanite state.

Is there any way to do this without adding a blank ("") entry to mycollection list?

Thanks,
JohnB
0
Comment
Question by:jxbma
  • 2
2 Comments
 
LVL 7

Expert Comment

by:prosh0t
ID: 20379977
It should just be like this: comboBox1.SelectedIndex = -1;
0
 
LVL 7

Accepted Solution

by:
prosh0t earned 125 total points
ID: 20379980
this also works:
comboBox1.SelectedItem = null;
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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