private void btnConfirm_Click(object sender, EventArgs e) { if (txtMemID.Text.Trim() == string.Empty) { MessageBox.Show("MemberID must be entered!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int memID = Convert.ToInt32(txtMemID.Text); DataSet ds1; ds1 = Databases.ValidUser(memID); int r = ds1.Tables["Members"].Rows.Count; if (r < 1) { MessageBox.Show("MemberID not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMemID.ResetText(); } else { //Display Confirm Dialog DialogResult result = MessageBox.Show("Are you sure you want to cancel this booking?", "Cancel", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { //Retrieve ConcertID in Column0 of the row selected Databases booking = new Databases(); int id = Convert.ToInt32(grdBookedClasses.Rows[grdBookedClasses.CurrentCell.RowIndex].Cells[0].Value); booking.GetABooking(id); //Cancel Booking booking.CancelBooking(id); //Display Cancellation Message MessageBox.Show("Booking has been cancelled!", "Cancellation", MessageBoxButtons.OK, MessageBoxIcon.Information); grdBookedClasses.DataSource = Databases.GetMemberBookings(Convert.ToInt32(txtMemID.Text)).Tables["Bookings"]; this.Close(); parent.Visible = true; } } } }