你好全部 我真的需要你的帮助,我在大学的最后一个项目
我必须制作矩阵的文本框,用户可以选择它的大小 但我不知道我创建它后我如何引用文本框所以我可以做计算 ,我该如何改变类型。 ,这是我提出来获得在运行时的文本框代码 我希望你帮我 C#代码如何从动态文本框中获取值?
private void button1_Click(object sender, EventArgs e)
{
//TextBox tb = new TextBox();
int y = 10;
row = Convert.ToInt32(textBox1.Text);
int col = row;
//string []a = new string[row];
int count = 0;
int sum;
for (int i = 0; i < row; i++)
{
int x = 10;
for (int j = 0; j < col; j++)
{
t = new TextBox();
t.Size = new Size(50, 20);
t.Name = "tb" + count;
count++;
t.Location = new Point(x, y);
t.Visible = true;
//t.GetType();
//a[row] = t.Text;
Controls.Add(t);
x = x + 70;
//t.Text =Convert.ToDecimal(t.Text);
//Convert.ToDecimal(t.Text);
if (t.Name == "tb1")
t.Text = "10";
}
y = y + 25;
}
非常感谢你,我希望你更新我的网页,如果我有其他问题 – user607631 2011-02-08 06:17:28