samedi 9 mai 2015

Loop Through Textboxes Controls

I use this code in Windows Form in Visual Studio

private void dispatcherTimer_Tick(object sender, EventArgs e)
{
     int ans = 0;
     for (int i = 0; i < 5; i++)
        for (int j = 0; j < 5; j++)
        {
             if ((Controls["t_" + i + "_" + j] as TextBox).BackColor ==  Brushes.Green)
             {
                  ans = ans * 1;
             }
             else
                  ans = ans * 0;
        }
}

I want to check all textbox colors in wpf windows form.

Aucun commentaire:

Enregistrer un commentaire