When I define a variable as below:
public static int x;
The program works properly but the variable is shared by users who enter the site. So the program doesn't work when users access at same time.
If I define a variable as below:
private int x;
the program doesn't work properly. for example, Can't find where checkbox true is.
The below code is for finding where the user check changed most recently.
public static CheckBox[,] cbs = new CheckBox[14, 28];
public static bool[,] diffmap = new bool[14, 28];
or
private CheckBox[,] cbs = new CheckBox[14, 28];
private bool[,] diffmap = new bool[14, 28];
protected void CBs_CheckedChanged(object sender, EventArgs e)
{
int cur_x = 0;
int cur_y = 0;
int num_reserve = 0;
for (int i = 0; i < 14; i++)
{
for (int j = 0; j < 28; j++)
{
if (cbs[i, j].Checked != diffmap[i, j])
{
cur_x = i;
cur_y = j;
break;
}
}
}
for (int i = 0; i < 14; i++)
{
for (int j = 0; j < 28; j++)
{
diffmap[i, j] = cbs[i, j].Checked;
}
}
}
Aucun commentaire:
Enregistrer un commentaire