Im trying this code to affect all the textbox's in another form
//From form2
Principal FrmPrincipal = new Principal();
private void button1_Click(object sender, EventArgs e)
{
foreach (var control in FrmPrincipal.Controls)
{
if (control is TextBox)
{
((TextBox)control).Enabled = true;
((TextBox)control).Text = String.Empty;
}
}
}
But it isnt working, what else do I have to do. Thanks.
@DJ KRAZE Before oppening form2, this code disables all the textboxs of my Principal form and it does work
foreach(var control in this.Controls)
{
if (control is TextBox)
{
((TextBox)control).Enabled = false;
}
}