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.
ADAdministrator Syncfusion Team August 30, 2004 09:46 AM
Thanks for the compliments. We are glad that you liked our MultiColumnComboBox control. Please take a look at my responses for your queries below :
// To clear the selection
this.multiColumnComboBox1.SelectedItem = null;
// To clear the Text
this.multiColumnComboBox1.TextBox.Text = "";
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.
ADAdministrator Syncfusion Team August 31, 2004 11:34 AM
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.
ADAdministrator Syncfusion Team August 31, 2004 04:08 PM
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
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.
ADAdministrator Syncfusion Team August 31, 2004 10:45 PM
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.
ADAdministrator Syncfusion Team September 1, 2004 05:07 PM
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.