小bug!!!在线等!!!

wxiaozhe wxiaozhe 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
for(int i = 0;i < number;i++)
{
for(int j = 0;j < number;j++)
{
TextBox txt = new TextBox();
txt.Enabled = true;
//txt.AutoPostBack = true;
txt.ID = "txt" + i.ToString() + "__" + j.ToString() + num.ToString();
txt.Text = i.ToString() + "__" + j.ToString();
//aryxishu[i,j] = txt.Text.ToString();
txt.Style["top"] = TOP(i).ToString();
txt.Style["left"] = LEFT(j).ToString();
txt.Height = 25;
txt.Width = 100;
txt.Style["position"]="absolute";
txt.TextChanged += new System.EventHandler(this.txt_textchanged);
//txt.Attributes.Add("onclick","this.txt_textchanged");
aryTxt.Add(txt);
pnltxt.Controls.Add(txt);
ViewState["controlsadded"] = true;
}
}

其中,ArrayList aryTxt=new ArrayList();
static int number = 0;


void txt_textchanged(object sender,System.EventArgs e)
{
TextBox txt = (TextBox)sender;
int n = aryTxt.Count;
for(int i = 0;i < n;i++)
{
TextBox txt1 = (TextBox)aryTxt[i];
if(txt.ID == txt1.ID)
{
int x = i / number;
int y = i % number;
aryxishu[x,y] = txt1.Text.Trim();
}
}
}



为什么动态生成的textbox不响应textchanged事件????
麻烦各位了,急急急急!!!
问题解决立马给分!!!
...全文

相关推荐

评论 14
收藏 已收藏
分享
返回顶部
wxiaozhe
C# 111,130 成员 642,539 内容