I created a new button to reset the form which consists of
combobox,
textbox,
richtextbox,
disabled button
So, i created a utilities.cs class but its not working and gives an error.
ERROR: The type or namespace name 'ComboBox' could not be found.
namespace example
{
class Utilities
{
public static void ResetAllControls(Mainform form)
{
foreach (Mainform control in form.Controls)
{
if (form is ComboBox)
{
ComboBox comboBox = (ComboBox)control;
if (comboBox.Items.Count > 0)
comboBox.SelectedIndex = 0;
}
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire