我有一个关于C#中的文本框的问题。我做了一个按钮,点击后,将创建文本框:使用动态创建的文本框中的文本
private void helloButton_Click(object sender, EventArgs e)
{
TextBox txtRun = new TextBox();
TextBox txtRun2 = new TextBox();
txtRun2.Name = "txtDynamic2" + c++;
txtRun.Name = "txtDynamic" + c++;
txtRun.Location = new System.Drawing.Point(40, 50 + (20 * c));
txtRun2.Location = new System.Drawing.Point(250, 50 + (20 * c));
txtRun2.ReadOnly = true;
txtRun.Size = new System.Drawing.Size(200, 25);
txtRun2.Size = new System.Drawing.Size(200, 25);
this.Controls.Add(txtRun);
this.Controls.Add(txtRun2);
}
我怎么能拉用户类型为这些新生成的文本框,使用它作为一个不同的函数参数(其将被称为该文本一个不同的按钮)?我很新,可以使用帮助。
在此先感谢。
(文本框)this.Controls.Find( “txtDynamic2”,真)(0)应为(文本框)this.Controls.Find( “txtDynamic2”,真)[0] – Igoy 2013-02-09 11:33:01
哦..是,你甚至不给我一段时间修改? ':D' – spajce 2013-02-09 11:52:51
我现在就给它,它有时会奇怪地发生:),新手! – Igoy 2013-02-09 11:56:16