Goran Shoan

Goran Shoan

  • NA
  • 4
  • 7k

C# help please!

Sep 24 2011 11:48 AM
Hi I have a little problem with c # code. I wonder if you can help me because I have tried to solve this problem for several days. I get the error: "No overload for method 'ReserveOrCancelSeat' takes '0 'arguments

Here is the code:

 private void ReserveOrCancelSeat(SeatManager.DisplayOptions choice)
        {
            if (CheckSelectedIndex() == false)
            {
                MessageBox.Show("a seat must be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Is reserve selected
            if (rbtnReserve.Checked == true)
            {
                // Validate data
                string name = null;
                double price = 0.0;
                if (ReadAndValidateInput(out name, out price) == true)
                {
                    // Data is ok, reserve seat
                    if (!m_seatMngr.ReserveSeat(name, price, lbSeats.SelectedIndex))
                    {
                        // The seat was already reserved, ask user if we should continue with reservation
                        if (MessageBox.Show("The seat is already reserved, continue with reservation?", "Seat already reserved", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            // We continue. First cancel seat.
                            if (!m_seatMngr.CancelSeat(lbSeats.SelectedIndex))
                            {
                                // This should not happen, throw exception
                                throw new Exception("The seat could not be canceled.");
                            }
                            // Then we reserve it
                            if (!m_seatMngr.ReserveSeat(name, price, lbSeats.SelectedIndex))
                            {
                                // This should not happen, throw exception
                                throw new Exception("The seat could not be reserved.");

                            }
                        }
                    }
                }

            }
        }

private void btnOK_Click(object sender, EventArgs e)
        {
            ReserveOrCancelSeat(); // here comes the error message
        }

Answers (5)