C#如何获取动态添加textbox的值
就是这段代码,我想获取动态添加的textbox的值,请问怎么做,我设置了名字,但是我不知道怎么去访问。求详解,谢谢啦!privatevoidbutton1_Click(o...
就是这段代码,我想获取动态添加的textbox的值,请问怎么做,我设置了名字,但是我不知道怎么去访问。
求详解,谢谢啦 !
private void button1_Click(object sender, EventArgs e)
{
label2.Visible = true;
label2.Text = "请填写下列" + textBox1.Text + "阶行列式每个元素的值:";
int num = int.Parse(textBox1.Text);
for (int i = 1; i != num + 1; ++i)
for (int j = 1; j != num + 1; ++j)
{
TextBox text = new TextBox();
text.Location = new Point(125 + (i - 1) * 145, 155 + (j - 1) * 60);
text.Size = new Size(45, 35);
int temp = j * 10 + i;
text.Name = "A_" + temp.ToString();
this.Controls.Add(text);
Label lab = new Label();
lab.Text = "A" + j + i;
lab.Location = new Point(70 + (i - 1) * 145, 155 + (j - 1) * 62);
lab.Size = new Size(45, 20);
this.Controls.Add(lab);
}
} 展开
求详解,谢谢啦 !
private void button1_Click(object sender, EventArgs e)
{
label2.Visible = true;
label2.Text = "请填写下列" + textBox1.Text + "阶行列式每个元素的值:";
int num = int.Parse(textBox1.Text);
for (int i = 1; i != num + 1; ++i)
for (int j = 1; j != num + 1; ++j)
{
TextBox text = new TextBox();
text.Location = new Point(125 + (i - 1) * 145, 155 + (j - 1) * 60);
text.Size = new Size(45, 35);
int temp = j * 10 + i;
text.Name = "A_" + temp.ToString();
this.Controls.Add(text);
Label lab = new Label();
lab.Text = "A" + j + i;
lab.Location = new Point(70 + (i - 1) * 145, 155 + (j - 1) * 62);
lab.Size = new Size(45, 20);
this.Controls.Add(lab);
}
} 展开
2015-10-06
展开全部
用输入事件动态写入变量就好
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询