winforms - Reset the value of a GroupBox? -


so here's problem : want tic tac toe program, , have 9 buttons , 2 progress bar (for score)

i want when progress bar x or y performstep, 9 buttons (in groupbox) resets initial value (enable = true , text = " ", because disable after user clicked on , text changes x or o depending of player turn).

is there command can write every buttons resets or must 1 one ?

if want reset buttons more efficiently, reset them in loop.

this require buttons collected first, example:

public partial class form1 : form {     list<button> tictactoebuttons = new list<button>();      public form1()     {         initializecomponent();          tictactoebuttons.add(button1);         tictactoebuttons.add(button2);         ...     } 

then, can loop on them needed:

    private void resettictactoebuttons()     {         foreach (button button in tictactoebuttons)         {             button.enabled = true;             button.text = " ";         }     } 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -