mardi 10 mars 2015

Disable all texboxes, datetimepicker, comboboxes programatically

is there a way where I can disable all texboxes, datetimepicker, comboboxes in a form load?


I have a condition in my form_load like this:



private void frmTWLeasing_Load(object sender, EventArgs e)
{
//this.Text = sTitle;
this.txtNinja1.Text = sEnable;
if (sEnable == "Disabled")
{

disable all textboxes, datetimepicker, comboboxes or gridviews
}
else
{
enable all textboxes, datetimepicker, comboboxes or gridviews
}
}


I have so many textboxes, datetimepicker, and comboboxes in this form including a datagridview, so is there any syntax where I can call all textboxes, datetimepicker, comboboxes so that I can disable this at one time? It's hard to disable it one by one.. Hope you can help me guys Thanks in advance!!


Aucun commentaire:

Enregistrer un commentaire