c# - two dimensional label not working -


i have code display 81 labels in table. when try write code not displaying labels. can tell me problem ??

label[,] val = new label[9,9];         point p = new point();         p.x = 300;         p.y = 300;         (int = 0; < 9; i++)         {             (int j = 0; j < 9; j++)             {                 val[i, j] = new label();                 val[i, j].location = p;                 p.x = p.x + 20;                 val[i, j].text = i.tostring();                 this.controls.add(val[i, j]);             }             p.y = p.y + 50;         } 

as hungpv pointed,

you using same point object

try this:

label[,] val = new label[9, 9];  int x = 0; int y = 0; (int = 0; < 9; i++) {     (int j = 0; j < 9; j++)     {       val[i, j] = new label();       val[i, j].location = new point(x,y);       x +=  20;       val[i, j].text = "row: " + +"column: " + j;       controls.add(val[i, j]);     }     y += 50; } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -