Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please go inside this link http://imageshack.us/photo/my-images/197/skit2.png/[^] and you will see the result of my code. It should not be like that i want the input element to show up, not two element of "false" and "true". Why do i Get this, how can i get the the input value in the listbox as well as the combobox text in the same row?? maybe this code could make you help me

C#
private bool ReadAndValidateInput(out string name, out double price)
       {


           ReadAndValidateName(out name);
           ReadAndValidatePrice(out price);

           //name = txtName.Text;
           //price = +Double.Parse(txtPrice.Text);

           if (ReadAndValidateName(out name) && ReadAndValidatePrice(out price))
           {
               ReadAndValidateName(out name);
               ReadAndValidatePrice(out price);
               return true;
           }
           else
               return false;

       }


C#
public bool ReserveSeat(String name, double price)
       {
         if (m_nameList[10] ==null)
         {
               m_nameList[10] = name;
               m_priceList[10] = price;

               return true;
           }
           else
           {
               return false;
           }
       }




C#
private void ReserveOrCancelSeat(SeatManager.DisplayOptions choice)
      {
         if (rbtnReserve.Checked == true)
          {
              // Validate data
              string name = null;
              double price = 0.0;

              if (ReadAndValidateInput(out name, out price) == true)
                  lstReservations.Items.Add(!m_seatMngr.ReserveSeat(name, price));
              {
                  if (!m_seatMngr.ReserveSeat(name, price))
                  {
                      lstReservations.Items.Add(!m_seatMngr.ReserveSeat(name, price));
                      // 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.

                          // Then we reserve it
                          if (!m_seatMngr.ReserveSeat(name, price))
                          {
                              // This should not happen, throw exception
                          //    throw new Exception("The seat could not be reserved.");

                          }
                      }
Posted

1 solution

lstReservations.Items.Add(!m_seatMngr.ReserveSeat(name, price));
ReserveSeat appears to returns a bool: so I'd expect to see a bool in the ListBox.

I don't see you accessing the Reservations drop-down anywhere in the code you posted here.

Try setting a break-point, and single-stepping through your code, and observing what happens.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900