Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:33:55+00:00 2026-06-09T08:33:55+00:00

I have a form that the user inputs values that i save in an

  • 0

I have a form that the user inputs values that i save in an array but when the user wants to cancel i want the user to be asked a final time if the user wants to go ahead and cancel a reservation. If the user declines this final time i want the program to go back to the GUI and focus on the textbox with all the rows of reservations and not do the cancelation but i show u the code i have written and it asks the user if they are sure and if not it still deletes the reservation and then focus on the textbox. What is wrong in my code?

public void Cancelreservation()
{
    int index = lstReservations.SelectedIndex;
    bool checkedindex = m_seatMngr.CheckIndex(index);
    if (checkedindex)
    {

        if (!m_seatMngr.CancelSeat(index))
        {
            if (lstReservations.SelectedIndex == -1)
            {
                MessageBox.Show("You need to select a row.", "Error!",
                MessageBoxButtons.OK,
                MessageBoxIcon.Exclamation,
                MessageBoxDefaultButton.Button1);
                lstReservations.Focus();
            }
            else
            {
                MessageBox.Show("The seat is not reserved! No need to cancel 
                                  reservation.", "Important Query", 
                                  MessageBoxButtons.OK);
                lstReservations.Focus();
            }
        }
        else
        {
            if (MessageBox.Show("Continue to cancel the reservation?", 
                                "Important Query", MessageBoxButtons.YesNo) 
                                == DialogResult.No)
            {
                lstReservations.Focus();                                
            }
            else
            {
                m_seatMngr.CancelSeat(index);
            }
        }
    }

m_seatMngr

         public bool CancelSeat(int index)
    {

        if (m_vacantList[index] == "Reserved") 
        {
            m_nameList[index] = " - ";
            m_priceList[index] = 0;
            m_vacantList[index] = "Vacant";
            return true;
        }
        else
        {
            return false;              
        }

    }         
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:33:56+00:00Added an answer on June 9, 2026 at 8:33 am

    Assuming that m_seatMngr.CancelSeat(index) is the method that actually cancels the seat, you are calling the method twice. The second if statement, half a dozen lines into your code, is this:

    if (!m_seatMngr.CancelSeat(index))
    

    … and it seems likely (given the above assumption) that this line will cancel the seat before you even display the MessageBox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a login form that has Username and password as inputs from user
I have a form that the user submits and returns a result, but it
Here's what I want to do. I have a form that the user fills
We have an entry form that gives the user a calendar drop down, but
So I have a form that accepts some input from a user that may
So I have a form that the user fills out, when submitted an new
I have a form that allows a user to import a spreadsheet. This spreadsheet
I have a form that enables a user to update multiple alert rules records
I currently have form that checks if a user has unsubmitted changes when they
I have a user form that is working perfectly. The page makes use of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.