Example #1
0
 private void BtnNew_Click(object sender, EventArgs e)
 {
     try
     {
         Edit(true);
         appData.Medicament.AddMedicamentRow(""); // appData.Medicament.NewMedicamentRow()
         medicamentBindingSource.MoveLast();
         TxtFldTitle.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         appData.Medicament.RejectChanges();
     }
 }
Example #2
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         Edit(false);
         medicamentBindingSource.EndEdit();
         //appData.Medicament.AcceptChanges(); //
         medicamentTableAdapter.Update(appData.Medicament);
         dtGrdMedicament.Refresh();
         TxtFldTitle.Focus();
         MessageBox.Show("Your database has been updated", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         appData.Medicament.RejectChanges();
     }
 }
Example #3
0
 private void BtnEdit_Click(object sender, EventArgs e)
 {
     Edit(true);
     TxtFldTitle.Focus();
 }