Problem trying to clear text from combo box in dropdownlist mode

Posted on 2005-05-06
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.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.  
Question by:jjacksn
    LVL 48

    Accepted Solution

    This line worked in my test:

    comboBox1.SelectedIndex = -1;
    LVL 8

    Assisted Solution

    Is this related to the bug as narrated below


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    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…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    745 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

    18 Experts available now in Live!

    Get 1:1 Help Now