如何编写代码使用按钮添加另一个文本框? [英] How to write a code add another textbox using button?

查看:90
本文介绍了如何编写代码使用按钮添加另一个文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何添加其他文本框。你告诉我一个简单的例子吗?

How to add another textbox. any one u tell me simple example?

推荐答案

根据给定的小信息,我可以回答你的问题如下:

With the given little info, I can answer your question like given below :
Button_Click(object sender, EventArgs e)
{
    TextBox txt = new TextBox();
    txt.ID = "myTxt";
    this.Controls.Add(txt);
}





-KR



-KR


Button_Click(对象发件人,EventArgs e)

{

TextBox newTxt = new TextBox();

newTxt.ID =newTxt;

this。 Controls.Add(newTxt);

}
Button_Click(object sender, EventArgs e)
{
TextBox newTxt= new TextBox();
newTxt.ID = "newTxt";
this.Controls.Add(newTxt);
}


这篇关于如何编写代码使用按钮添加另一个文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆