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
}
Loading
Mayur DighePosted Sep 27, 2011, 11:40 AM
sorryyy..... for late reply.....
Agree to Vulpes's opinion. But dear friend, you are again doing the same thing. Please don't write word "choice" as it is as shown in example.
choice is the object of SeatManager.DisplayOptions DataType, so pass the parameter of type SeatManager.DisplayOptions.
I think you are using Enum values or Integer Values, so pass that VALUES
VulpesPosted Sep 24, 2011, 2:21 PM
Goran ShoanPosted Sep 24, 2011, 12:32 PM
VulpesPosted Sep 24, 2011, 12:22 PM
Mayur DighePosted Sep 24, 2011, 12:18 PM
you just make a single Silly Mistake, need to correct it.
you can do it, but need to just pass the appropriate argument with ReserveOrCancelSeat() Function.
i.e. ReserveOrCancelSeat(choice);
This will work.....
Happy Programming................