C#动态生成TextBox循环赋值问题
for(inti=0;i<((num/4));i++){for(intj=0;j<4;j++){TextBoxTextBox1=newTextBox();TextBox1...
for (int i = 0; i < ((num / 4)); i++)
{
for (int j = 0; j < 4; j++)
{
TextBox TextBox1 = new TextBox();
TextBox1.Text = "";
TextBox1.Multiline = true;
TextBox1.Size = new System.Drawing.Size(52, 31);
TextBox1.Margin = new System.Windows.Forms.Padding(0);
TextBox1.Location = new Point(64 + textBox222.Width * j, 60 + i * 50);
TextBox1.Name = "TextBox" + i.ToString() + j.ToString();
this.Controls.Add(TextBox1);
foreach (Control c in this.Controls)
{
if (c.Name == "TextBox" + i.ToString() + j.ToString())
{ //for循环动态赋值
for (int m = 0; m < num; m++)
{
c.Text = Convert.ToString(m);
}
}
动态赋值那里应该怎么写?
num为TextBOx输入的数值 textbox里的值从1到num 展开
{
for (int j = 0; j < 4; j++)
{
TextBox TextBox1 = new TextBox();
TextBox1.Text = "";
TextBox1.Multiline = true;
TextBox1.Size = new System.Drawing.Size(52, 31);
TextBox1.Margin = new System.Windows.Forms.Padding(0);
TextBox1.Location = new Point(64 + textBox222.Width * j, 60 + i * 50);
TextBox1.Name = "TextBox" + i.ToString() + j.ToString();
this.Controls.Add(TextBox1);
foreach (Control c in this.Controls)
{
if (c.Name == "TextBox" + i.ToString() + j.ToString())
{ //for循环动态赋值
for (int m = 0; m < num; m++)
{
c.Text = Convert.ToString(m);
}
}
动态赋值那里应该怎么写?
num为TextBOx输入的数值 textbox里的值从1到num 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询