private void cmdadd_Click(object sender, EventArgs e) { newstorerahniform ckf = new newstorerahniform(0); ckf.ShowDialog(); BindData(); }
private void cmdedit_Click(object sender, EventArgs e) { if (grid1.SelectedRows.Count == 0) { MessageBox.Show("یک سطر را انتخاب کنید"); } else { DataRowView drv = (DataRowView)grid1.SelectedRows[0].DataBoundItem; newstorerahniform ckf = new newstorerahniform(1); ckf.id = (int)drv.Row["id"]; ckf.adress = (drv.Row["adress"] != System.DBNull.Value ? (string)drv.Row["adress"] : ""); ckf.gheymat = (drv.Row["gheymat"] != System.DBNull.Value ? (string)drv.Row["gheymat"] : ""); ckf.kharidar = (drv.Row["namekharidar"] != System.DBNull.Value ? (string)drv.Row["namekharidar"] : ""); ckf.saheb = (drv.Row["namesaheb"] != System.DBNull.Value ? (string)drv.Row["namesaheb"] : ""); ckf.tarikh = (drv.Row["tarikh"] != System.DBNull.Value ? (string)drv.Row["tarikh"] : ""); ckf.ShowDialog(); BindData(); } }