//button按下 string a = TextBox1.text; string b = TextBox1.text; string c = TextBox1.text; int row = 0;//行 int col = 0;//列 temptable.Rows[row][col] = a; temptable.Rows[row][col++] = b; temptable.Rows[row][col++] = c;
string a = TextBox1.text; string b = TextBox2.text; string c = TextBox3.text; ...... string c = TextBoxn.text; temptable.Rows[row][col] = a; temptable.Rows[row][col++] = b; temptable.Rows[row][col++] = c; ...... temptable.Rows[row][col++] = n; 你觉得不多吗?可不可以有一个办法如:循环检索一行的每列并写入相对应的TextBoxn的信息???
不会这样啊: ArrayList a = new ArrayList(); string b = TextBox1.text; a.Add(b); b = TextBox2.text; a.Add(b); b = TextBox3.text; a.Add(b); for(int i = 0, i < 3; i ++) { temptable.Rows[row][i] = a[i]; }
string a = TextBox1.text;
string b = TextBox1.text;
string c = TextBox1.text;
int row = 0;//行
int col = 0;//列
temptable.Rows[row][col] = a;
temptable.Rows[row][col++] = b;
temptable.Rows[row][col++] = c;
安全第一,不怕断电,数据稳定,不哭~说错了 就请买2斤包子,我去撑死
有几行就循环几次,代码有什么多的?不理解了!
string b = TextBox2.text;
string c = TextBox3.text;
......
string c = TextBoxn.text;
temptable.Rows[row][col] = a;
temptable.Rows[row][col++] = b;
temptable.Rows[row][col++] = c;
......
temptable.Rows[row][col++] = n;
你觉得不多吗?可不可以有一个办法如:循环检索一行的每列并写入相对应的TextBoxn的信息???
ArrayList a = new ArrayList();
string b = TextBox1.text;
a.Add(b);
b = TextBox2.text;
a.Add(b);
b = TextBox3.text;
a.Add(b);
for(int i = 0, i < 3; i ++)
{
temptable.Rows[row][i] = a[i];
}
temptable.Rows[row][i] = a[i].ToString();