主题:C# 25个文本框里输入1到25
一共有25个文本框 我想 在每个文本框里 显示 指定文本框+3
像我这样做的话 总是显示同一数字或 都是连数
能不能做到 我输入的数字比如我在 textbox26.text输入 5的话
textbox1~25 显示textbox+3(5,8,11,14,17,20。。。) 填写不完的文本框 都变成0
protected void Page_Load(object sender, EventArgs e)
{
TextBox txt = null;
for (int a = 1; a <= 25; a++)
{
if (a % 3 == 0)
{
foreach (Control c in Page.Controls)
{
if (c.GetType().Name == "HtmlForm")
{
foreac停h (Control c1 in c.Controls)
{
if (c1.GetType().Name == "TextBox")
{
txt = ((TextBox)c1);
txt.Text = Convert.ToString(a);
}
}
}
}
}
}
}
像我这样做的话 总是显示同一数字或 都是连数
能不能做到 我输入的数字比如我在 textbox26.text输入 5的话
textbox1~25 显示textbox+3(5,8,11,14,17,20。。。) 填写不完的文本框 都变成0
protected void Page_Load(object sender, EventArgs e)
{
TextBox txt = null;
for (int a = 1; a <= 25; a++)
{
if (a % 3 == 0)
{
foreach (Control c in Page.Controls)
{
if (c.GetType().Name == "HtmlForm")
{
foreac停h (Control c1 in c.Controls)
{
if (c1.GetType().Name == "TextBox")
{
txt = ((TextBox)c1);
txt.Text = Convert.ToString(a);
}
}
}
}
}
}
}