如何创建multipal texbox [英] how to create multipal texbox
本文介绍了如何创建multipal texbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请任何人告诉我如何创建多个文本框?这意味着有一个Texbox,并假设我们在该文本框中输入"3",然后应创建3个文本框.
请任何人帮助我.
Please any one tell me how to create multiple textboxes? It means one Texbox is there, and suppose we enter "3" in that textbox, then 3 textboxes should be created.
Please anybody help me.
推荐答案
动态控制生成
dynamically controls generation
for (int j = 1; j <= Convert.ToInt32(txtNoOFControl.text); j++)
{
TextBox txt = new TextBox();
txt.Size = new Size(34, 24);
txt.Location = new Point(((j % 20) * 34), (j / 20 * 34));
txt.Text = j.ToString();
txt.TabIndex = j;
txt.Visible = true;
this.Controls.Add(txt);
}
您需要根据第一个文本框的计数动态创建文本框,如下所示.
You need to create textboxes dynamically based on the count of the first textbox as below.
for (int i;i <= int.Parse(mytextbox.text);i++)
{
System.Windows.Forms.TextBox textbox = new System.Windows.Forms.TextBox();
textbox.Name = "textbox"+i.ToString();
textbox.TabIndex = i;
textbox.Visible = true;
Controls.Add(textbox);
}
这篇关于如何创建multipal texbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文