We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to clear the text on a ComboBox when in DropDownList mode.

Thread ID:





18374 Aug 30,2004 12:25 AM UTC Sep 1,2004 09:07 PM UTC WinForms 5
Tags: Tools
Administrator [Syncfusion]
Asked On August 30, 2004 12:25 AM UTC

I am converting my code from using a custom ButtonEdit control to the new MultiColumn ComboBox. Everything seems to work perfectly (great job on this new control), except that I want to be able to to A) Have nothing selected by default and B) Be able to clear out the textbox (or have nothing selected) if the control is disabled. I tried setting the .Text property and the Textbox.Text and it wouldn''t clear it. I also tried to set the SelectedIndex and SelectedValue to -1 and that didn''t do it either. Any help would be great. Thank you, Javier

Administrator [Syncfusion]
Replied On August 30, 2004 01:46 PM UTC

Hi Javier, Thanks for the compliments. We are glad that you liked our MultiColumnComboBox control. Please take a look at my responses for your queries below : (A) // To clear the selection this.multiColumnComboBox1.SelectedItem = null; (B) // To clear the Text this.multiColumnComboBox1.TextBox.Text = ""; this.multiColumnComboBox1.Refresh(); Please refer to the sample attached that illustrates this and let me know if this works for you. Thanks for your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Administrator [Syncfusion]
Replied On August 31, 2004 03:34 PM UTC

Thanks for the reply. This solution kind of works if i assign it to a button. Even then, I sometimes have to click the button twice for it to clear. I am putting all 3 lines you gave me (vb.net equivalent). this solution does not work if I put the code in the load event (which I also need). Any idea why? In the sample you gave me, if you enable the box, and select an item manually and then try to clear it, it sometimes requires clicking the button twice. The on load behavior does not seem to occur on your sample. Any help would be appreciated. Thank you. Javier

Administrator [Syncfusion]
Replied On August 31, 2004 08:08 PM UTC

Hi Javier, Thanks for the update. I do see that sometimes the "Clear" button has to be clicked twice to clear the text in the MultiColumnComboBox. To overcome this problem, I have now changed the code to "clear" as shown below : '' To clear the selection Me.multiColumnComboBox1.SelectedItem = Nothing Me.multiColumnComboBox1.SelectedIndex = - 1 '' To clear the Text Me.multiColumnComboBox1.UpdateText(True) I have also modified my earlier sample and have attached a VB.NET version of the modified sample here. The MultiColumnComboBox now gets cleared in the Form''s Load event as well. Please refer to the sample and let me know if you need further assistance. Thanks for your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Administrator [Syncfusion]
Replied On September 1, 2004 02:45 AM UTC

I am still having this problem, and it seem to also happen on the ComboBoxAdv Controls. The wierd thing is, that it seems to not trigger in the load at all (on both type of controls), but if I put the code in a button it works fine (I do still get the double click issue) I found a temp solution (or atleast one i''m willing to live with in 90% of the senarios). On the multi column version, I add a row and then hide that row and just make sure to select that row when i want nothing selected. For single column combobox, I do the same, but this item will now be shown and selectable by the user. That is fine with most boxes since I can put "SELECT ITEM" or whatever message. This ofcourse doesn''t clear the textbox for me (which I need) but I guess i could programmaticly put the string to empty and then select that item. Sigh....thanks for your help, I wish your way would work in my code. Hopefully I can get some free time and trace the order things get trigger (maybe the object has some events that get trigger after the on load event for my form that is resetting it). Thanks for your help. Javier

Administrator [Syncfusion]
Replied On September 1, 2004 09:07 PM UTC

Hi Javier, Thanks for the update. I have tested the approach suggested in my earlier update in our ComboBoxAdv samples and would like to confirm that it works fine (both in Form Load and Button Click event handlers). In your case, it could be a usage issue in your application. Please create a Direct-Trac incident in this regard, and send us a very basic (highly stripped down) version of your application that shows this problem. We could then further investigate this issue and suggest you an appropriate solution. We appreciate your cooperation. Regards, Guru Patwal Syncfusion, Inc.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon