Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to clear a combobox?
Message
De
29/04/2004 09:59:34
John Baird
Coatesville, Pennsylvanie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00898211
Message ID:
00899316
Vues:
29
I typed to quickly. I have a container on the form and its the cnt_Load event where I set them.


>A ComboBox doesn't have a load event. ???
>
>>How about the load event of the combobox? This is where I set display index to -1 to display nothing.
>>
>>
>>>I have a WinForm where the user can select criteria for a database search. On the form (among other controls) is a combobox which is bound to a table in a dataset. When the form appears, I want the combobox display item to be empty. So I created a method ClearAll() that sets
>>>
>>>this.MyComboBox.SelectedIndex = -1;
>>>
>>>I tried placing a call to this method at the end of the form Load method, after filling the dataset, but this did not work. However, I did add a command button to the form and put the call
>>>
>>>this.ClearAll();
>>>
>>>in the click event handler of the command button. This did have the desired effect of clearing the combobox display item. So apparently calling ClearAll in the Load method is too early in the sequence of events as the form becomes visible.
>>>
>>>How can I get the combobox to display empty initially? Is there a later form event that should handle this?
>>>
>>>TML
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform