//标示类。
public class Class1
{
public static string hasdo;//标记纪录添加、修改操作是否进行
public static string[] tt;//添加记录后返回数组
}
//主窗体Button里添加 跳转
private void bt_add_Click(object sender, EventArgs e)
{
Class1.hasdo = "no";
rygl_add f_add = new rygl_add();
f_add.ShowDialog();
if (Class1.hasdo == "yes")
{
DataTable t1 = new DataTable();
t1 = (DataTable)this.dataGridView1.DataSource;
t1.Rows.Add(Class1.tt);
}
}
//添加窗体里接收,返回
//添加成功后,用下面的代码接收返回。
Class1.tt = new string[] { ryid, dabh, xm, xb, mz, csrq, csdd, zzmm, zgxl, bysj, sxzy, csjssj, gzsj, xrzw, gbsj, gzgw, cssj, jszc, jszcjb, hdsj, bz };
Class1.hasdo = "yes";
this.Close();
//主窗体接收 修改类似。
Class1.hasdo = "no";
String ryid = this.dataGridView1.CurrentRow.Cells["ryid"].Value.ToString();
rygl_change fedit = new rygl_change(ryid);
fedit.ShowDialog();
if (Class1.hasdo == "yes")
{
this.dataGridView1.CurrentRow.Cells[0].Value = Class1.tt[0];//后面依次。
}