一个窗体到另一个窗体数据的传递 如题 最好有实例 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //Main private void btn_Click(object sender, EventArgs e) { frmEx myForm = new frmEx(7);//传参 myForm.Show(); }//被调用的窗体 int count = 0; public frmEx() { InitializeComponent(); } public frmEx(int i) { InitializeComponent(); count = i; this.txtLetter.Text = count.ToString(); } Form2中先定义一个delegatepublic delegate void returnvalue( int i );public returnvalue ReturnValue;form2 中的button按钮代码如下:private void button1_Click(object sender, System.EventArgs e){ if ( ReturnValue != null ) ReturnValue( 8 );} Form1中的button按键如下:private void button1_Click(object sender, System.EventArgs e){ Form2 temp = new Form2( ); temp.ReturnValue = new temp.Form2.returnvalue( showvalue ); temp.Show();} private void showvalue( int i ){ textBox1.Text = i.ToString();} 点击form2的button,form1中的textbox中的值就会相应变化。 使用窗体自带的Tag属性,把要传递的参数带过去 LINQ 联合查询datatable 和xml 报表高手来看看,你一句话也许就解决 一个关于句柄的难题! ImageList空间如何动态设置其大小 菜鸟问题为何table.GetChanges();返回null 大家好!好久没来提问了,又得来麻烦大家,关于怎么在工程里添加已注册好的全局程序集的问题!很奇怪 查看DLL代码 如何根据Json字符串自动生成结构呢~~~~~~~~~~~~~~~~~~~~~~~~ 关于ACCESS的小问题,看上去字多,实际简单!马上结帖! 新手请教一个C#调数据库的问题 null值的问题 怎样在c# 2005 web 开发中添加控件自定义事件
{
frmEx myForm = new frmEx(7);//传参
myForm.Show();
}//被调用的窗体 int count = 0;
public frmEx()
{
InitializeComponent();
} public frmEx(int i)
{
InitializeComponent();
count = i;
this.txtLetter.Text = count.ToString();
}
Form2中先定义一个delegatepublic delegate void returnvalue( int i );public returnvalue ReturnValue;form2 中的button按钮代码如下:private void button1_Click(object sender, System.EventArgs e){ if ( ReturnValue != null ) ReturnValue( 8 );} Form1中的button按键如下:private void button1_Click(object sender, System.EventArgs e){ Form2 temp = new Form2( ); temp.ReturnValue = new temp.Form2.returnvalue( showvalue ); temp.Show();} private void showvalue( int i ){ textBox1.Text = i.ToString();} 点击form2的button,form1中的textbox中的值就会相应变化。