private void cmdadd_Click(object sender, EventArgs e) { newzaminmelkform rrf = new newzaminmelkform(0); rrf.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; newzaminmelkform rrf = new newzaminmelkform(1); rrf.id = (int)drv.Row["id"]; rrf.adress = (drv.Row["adress"] != System.DBNull.Value ? (string)drv.Row["adress"] : ""); rrf.metraj = (drv.Row["metraj"] != System.DBNull.Value ? (string)drv.Row["metraj"] : ""); rrf.forosh = (drv.Row["forosh"] != System.DBNull.Value ? (string)drv.Row["forosh"] : ""); rrf.ShowDialog(); BindData(); } }