winform 利用属性在父、子窗体间传值
000
父窗口:
public partial class wc_DanChen : Form
{
public int userID;
public wc_DanChen()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
wc_NewYard NewForm = new wc_NewYard(this);
NewForm.show();
}
}
子窗口
public partial class wc_NewRoll : Form
{
private wc_NewYard frmParent;
public wc_NewRoll(wc_NewYard parent)
{
InitializeComponent();
frmParent = parent;
}
private void button3_Click(object sender, EventArgs e)
{
frmParent.userID = " ";
this.close();
}
}
public partial class wc_DanChen : Form
{
public int userID;
public wc_DanChen()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
wc_NewYard NewForm = new wc_NewYard(this);
NewForm.show();
}
}
子窗口
public partial class wc_NewRoll : Form
{
private wc_NewYard frmParent;
public wc_NewRoll(wc_NewYard parent)
{
InitializeComponent();
frmParent = parent;
}
private void button3_Click(object sender, EventArgs e)
{
frmParent.userID = " ";
this.close();
}
}
posted on 2010-11-09 14:24 lijinchang 阅读(110) 评论(0) 编辑 收藏 举报