private void RemoveButton_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("آیا از حذف مطمئن هستید؟", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { try { selectedRow = cityDataGridView.CurrentCell.RowIndex; SqlManipulator sql = new SqlManipulator(); DataGridViewRow newDataRow = cityDataGridView.Rows[selectedRow]; CityTable deletedCity = new CityTable(); deletedCity.Id = (long)newDataRow.Cells[1].Value; deletedCity.CityName = (string)newDataRow.Cells[0].Value; sql.removeCity(deletedCity); var cityData = sql.getDataCity(); makeTable(cityData); } catch (Exception) { throw; } } }