private void buttonUpdateOrInsert_Click(object sender, EventArgs e) { Button but = (Button)sender; if (but.Name == buttonUpdate.Name) { try { Util.ID = (int)dGridView["ID", dGridView.CurrentRow.Index].Value; Util.Insert = false; } catch (NullReferenceException ex) { MessageBox.Show("Выбирете запись!"); return; } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } else { Util.Insert = true; } inserting insf = new inserting(); insf.ShowDialog(); this.Cursor = Cursors.WaitCursor; dcont.SubmitChanges(); dGridView.DataSource = tabDanie; this.Cursor = Cursors.Default; }
private void EditButton_Click(object sender, EventArgs e) { try { Util.ID = (int)dupletGrid["ID", dupletGrid.CurrentRow.Index].Value; Util.Insert = false; } catch (NullReferenceException ex) { MessageBox.Show("Выберите запись!"); return; } catch (Exception ex) { MessageBox.Show(ex.Message); return; } inserting insf = new inserting(); insf.ShowDialog(); dupletRecord(); }