private void MyCmdDelete_Click() { try { if ((string.IsNullOrEmpty(txtArea0)) || (string.IsNullOrEmpty(txtArea1)) || (string.IsNullOrEmpty(txtArea2))) { return; } var response = MessageBox.Show("!!!Do you really want to Delete this Area?\r\n" + cbArea_Item, "Deleting...", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (response == MessageBoxResult.No) { return; } string myWhere = string.Empty; myWhere = cbArea_Item.Substring(0, 4); bool myDelete = false; using (SqlExcuteCommand mySqlExe = new SqlExcuteCommand() { DBCnnStr = _DBEndososCnnStr }) { myDelete = mySqlExe.MyDeleteArea(myWhere); if (myDelete) { _MyAreasTable = mySqlExe.MyGetAreas(false); cbArea.Clear(); foreach (DataRow row in _MyAreasTable.Rows) { cbArea.Add(row[0].ToString()); } } } if (!myDelete) { throw new Exception("Error en la Base de Data"); } MessageBox.Show("Done...", "Delete", MessageBoxButton.OK, MessageBoxImage.Information); MyReset(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }