A窗体:
C# code
public class FormA : Form
{
//假若A中有一个DataGridView 名为 dgvList,在属性上将Modifier设成public
private void button1_Click(object sender, EventArgs e)
{
FormB frm = new FormB();
frm.MotherForm = this;
frm.Show();
}
}
B窗体
public class FormB : Form
{
public FormA MotherForm;
private void button1_Click(object sender, EventArgs e)
{
MotherForm.dgvList.DataSource = ....;//此处直接使用
//这样做在编程时可以获得更好的智能提示
}
}
C# code
public class FormA : Form
{
//假若A中有一个DataGridView 名为 dgvList,在属性上将Modifier设成public
private void button1_Click(object sender, EventArgs e)
{
FormB frm = new FormB();
frm.MotherForm = this;
frm.Show();
}
}
B窗体
public class FormB : Form
{
public FormA MotherForm;
private void button1_Click(object sender, EventArgs e)
{
MotherForm.dgvList.DataSource = ....;//此处直接使用
//这样做在编程时可以获得更好的智能提示
}
}