コード例 #1
0
 private void DeleteObject_Button_Click(object sender, EventArgs e)
 {
     if (Objects_DataGridView.CurrentRow == null)
     {
         Alert.DisplayError("No item selected!");
         return;
     }
     try
     {
         DataLayer.Object obj = new DataLayer.Object();
         obj.id_object = (int)Objects_DataGridView.CurrentRow.Cells[0].Value;
         ManagerService.DeleteObject(obj);
         int             index           = Objects_DataGridView.CurrentRow.Index;
         CurrencyManager currencyManager = (CurrencyManager)BindingContext[Objects_DataGridView.DataSource];
         currencyManager.SuspendBinding();
         Objects_DataGridView.Rows[index].Visible = false;
         currencyManager.ResumeBinding();
     }
     catch (ServiceException exc)
     {
         Alert.DisplayError(exc.Message);
     }
 }