C#点击from1中的button控件后,控件文本text显示到from2 中的Label里

C#点击from1中的button控件后,控件文本text显示到from2 中的Label里
C#vs2010 Windowsform窗体有两个from,点击from1中的button控件后,from1中的button控件文本内容text,显示到from2 中的Label里

winform还是asp.net
对于asp.net
protected void Button1_Click(object sender, EventArgs e)
{
int hits;
if (ViewState["hits"] == null)
{
hits = 0;
}
else
{
hits = (int)ViewState["hits"];
}
hits++;
ViewState["hits"] = hits;
this.TextBox1.Text = hits.ToString();
}

对于winform

public int i;
private void button1_Click(object sender, EventArgs e)
{
i++;
this.textBox1.Text = "单击了"+i.ToString()+"次";
}

private void Form1_Load(object sender, EventArgs e)
{
i = 0;
}

以上代码vs 2005 vs 2008均调试通过追问

winform, 有详细步骤么 ,新手 谢谢

温馨提示:答案为网友推荐,仅供参考
相似回答