private void cmdedit_Click(object sender, EventArgs e) { if (grid1.SelectedRows.Count == 0) { MessageBox.Show("یک سطر را انتخاب کنید"); } else { DataRowView drv = (DataRowView)grid1.SelectedRows[0].DataBoundItem; newforoshandeform eef = new newforoshandeform(1); eef.id = (int)drv.Row["id"]; eef.name = (drv.Row["name"] != System.DBNull.Value ? (string)drv.Row["name"] : ""); eef.family = (drv.Row["family"] != System.DBNull.Value ? (string)drv.Row["family"] : ""); eef.shenasname = (drv.Row["shsh"] != System.DBNull.Value ? (string)drv.Row["shsh"] : ""); eef.father = (drv.Row["nfather"] != System.DBNull.Value ? (string)drv.Row["nfather"] : ""); eef.tells = (drv.Row["tells"] != System.DBNull.Value ? (string)drv.Row["tells"] : ""); eef.tellh = (drv.Row["tellh"] != System.DBNull.Value ? (string)drv.Row["tellh"] : ""); eef.adressm = (drv.Row["adressmanzel"] != System.DBNull.Value ? (string)drv.Row["adressmanzel"] : ""); eef.adressw = (drv.Row["adresswork"] != System.DBNull.Value ? (string)drv.Row["adresswork"] : ""); eef.ShowDialog(); BindData(); } }
private void cmdadd_Click(object sender, EventArgs e) { newforoshandeform sef = new newforoshandeform(0); sef.ShowDialog(); BindData(); }