Validating whether or not a button was clicked in a panel
<p>So I'm trying to validate whether or not a button is clicked within a panel.  This is to then reserve a seat on that button if there is no one else's name on it.  I keep getting the error 'panel' does not contain a definition for etc..etc.</p>

<pre><code>    public void DisplayReservations(String[] seating)
    {
        pnlBox.Controls.Clear();

        int startTop = 10;
        int startLeft = 10;

        for (int seat = 0; seat &lt;= seating.GetUpperBound(0); seat++)
        {
            Button newButton = new Button();
            this.Controls.Add(newButton);
            newButton.Text = ("Seat: " + (seat + 1) + " " + seating[seat]);
            newButton.Location = new System.Drawing.Point(startTop, startLeft + (seat * 30));
            newButton.Click += AButton_Click;
            pnlBox.Controls.Add(newButton);
        }
    }

    private void pictureBox1_Click(object sender, EventArgs e)
    {

    }

    private void radDenver_CheckedChanged(object sender, EventArgs e)
    {


        piclogo.Load("Cessna.jpg");
        lblFlightInfoOut.Text = "";
        lblStatusOut.Text = "";
        //show the flight info

        lblFlightInfoOut.Text = flight1.FlightInfo();


        string[] seatChart1 = flight1.GetReservationList();

        if (flight1.IsFull() == false)
        {

            DisplayReservations(seatChart1);
        }
        else
        {
            DisplayReservations(seatChart1);
            lblStatusOut.Text = "Flight " + flight2.Plane + " to " + flight1.Destination + " Is Full";
        }
    }

    private void radKC_CheckedChanged(object sender, EventArgs e)
    {
        piclogo.Load("Piper.jpg");
        lblStatusOut.Text = "";
        lblFlightInfoOut.Text = "";

        //show the flight info

        lblFlightInfoOut.Text = flight2.FlightInfo();

        string[] seatChart2 = flight2.GetReservationList();

        if (flight2.IsFull() == false)
        {

            DisplayReservations(seatChart2);
        }
        else
        {
            DisplayReservations(seatChart2);
            lblStatusOut.Text = "Flight " + flight2.Plane + " to " + flight2.Destination + " Is Full";
        }


    }

    private void btnNameSubmit_Click(object sender, EventArgs e)
    {
        string name = "";
        int seatNum;
        if (CheckText(txtName.Text) == true)
        {
            name = txtName.Text;


            if (radDenver.Checked == true)
            {
                if (ValidSelect(pnlBox.SelectedIndex) == true)
                {
                    seatNum = pnlBox.SelectedIndex;
                    if (flight1.MakeReservation(name, seatNum) == true)
                    {
                        lblStatusOut.Text = "Seat " + (seatNum + 1) + " is now Reserved for " + name;
                        DisplayReservations(flight1.GetReservationList());
                    }
                    else
                    {
                        lblStatusOut.Text = "Sorry " + name + " Seat " + (seatNum + 1) + " is Taken";
                    }
                }

            }
            else if (radKC.Checked == true)
            {
                if (ValidSelect(pnlBox.SelectedIndex) == true)
                {
                    seatNum = pnlBox.SelectedIndex;
                    if (flight2.MakeReservation(name, seatNum) == true)
                    {
                        lblStatusOut.Text = "Seat " + (seatNum + 1) + " is now Reserved for " + name;
                        DisplayReservations(flight2.GetReservationList());
                    }
                    else
                    {
                        lblStatusOut.Text = "Sorry " + name + " Seat " + (seatNum + 1) + " is Taken";
                    }
                }
            }
            else
            {
                lblStatusOut.Text = "Please Select a destination at Step 1";
            }
        }
    }


    private bool ValidSelect(int SelectedIndex)
    {
        if (pnlBox.AButton_Click == false)
        {
            lblStatusOut.Text = "Please Choose a seat from the List";
            return false;
        }
        return true;
    }
</code></pre>