private void RemoveSelectedExpenseButtonClick(object sender, EventArgs e) { if (expensesDataGridView.SelectedRows.Count > 0) // Check if user selected a row { int rowIndex = expensesDataGridView.CurrentCell.RowIndex; decimal value = decimal.Parse(expensesDataGridView.SelectedRows[0].Cells[1].Value.ToString()); Changes.RemoveExpense(value); // Remove record from database expensesDataGridView.Rows.RemoveAt(rowIndex); // Remove record from DataGridView UserBalanceLoad(); PieChartLoad(); ColumnChartLoad(); } else { string message = "You have to choose a row when trying to delete a record."; string title = "Error"; MessageBox.Show(message, title); } }