?
Solved

Problem trying to clear text from combo box in dropdownlist mode

Posted on 2005-05-06
5
Medium Priority
?
2,015 Views
Last Modified: 2007-12-19
I'm having issues trying to clear the text from a combo box when I am using dropdownlist comboboxstyle.  

Here is what I'm trying to do:  this works in my test app, but not in my real app.  I have EnabledVisualStyles in both apps:

Dim style As ComboBoxStyle = cmb.DropDownStyle
             cmb.DropDownStyle = ComboBoxStyle.DropDown
                cmb.SelectedItem = Nothing
                cmb.Text = ""
                cmb.Focus()
                cmb.DropDownStyle = style

This code works in one app, but not the other.  in the non-working app, the cmb.Text and cmb.SelectedItem fields are properly set to "" and nothing respectively, but when calling cmb.DropDownstyle = style, the text and selected item change back to their previously held values.  
0
Comment
Question by:jjacksn
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 1000 total points
ID: 13943306
This line worked in my test:

comboBox1.SelectedIndex = -1;
0
 
LVL 8

Assisted Solution

by:rajaloysious
rajaloysious earned 1000 total points
ID: 13945399
Is this related to the bug as narrated below
 http://support.microsoft.com/kb/327244

cheers
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

862 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