Here's an example of what I currently do:
book enable = false;
foreach (Control c in controlList)
{
if (c is MyTextBox)
{
(c as MyTextBox).Enabled = enable;
}
if...
...
}
Instead of having multiple if statements for every type of control, is there a way to get the type of the control in order to cast and then be able to access and set a property of that control?
Aucun commentaire:
Enregistrer un commentaire