首先,分First界面和Second界面
1.在second界面定义一个dgv类:
public static DataGridView Dgv;
public void PublicDgv(DataGridView dgv)
{
Dgv=dgv;
}
2.在first界面里实例化second界面对象:
Second second=new Second();
second.PublicDgv(first界面的一个dgv);
second.ShowDialog();
3.在second界面里补充数据绑定,如:
txt_KeHuBianMa.Text = DGV.CurrentRow.Cells["KeHuXinXiIDMC"].Value.ToString().Trim(); txt_XingMing.Text = DGV.CurrentRow.Cells["XingMing"].Value.ToString().Trim(); txt_XingBie.Text = DGV.CurrentRow.Cells["XingBie"].Value.ToString().Trim();