I'm getting this error, and I'm not sure why I can't do this in a method.

On lines 92 and 93 I get this error thrown:

"Only assignment, call, increment, decrement, and new object expressions can be used as a statement"

I'm sure it's something obvious, but I'm stumped.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Lab7
{
    public partial class Form1 : Form
    {

        bool activeFlight = true;
        private string[] passNameAr = { "", "", "", "", "", "", "", "", "", "",
                                        "", "", "", "", "", "", "", "", "", "" };
        private string[] seatAr = {"1A", "1B", "2A", "2B", "4A" ,"4B", "4C", "4D", "5A", "5B",
                                   "5C", "5D", "6A", "6B", "6C", "6D", "7A", "7B", "7C", "7D"};
        private int numFirstClass = 0,
                 numBusinessClass = 0,
                 counter = 0;
        private string[] flightClassAr = { "First", "Business" };

        private void PopulateSeatCombo()
        {
            this.textBox1.Enabled = false;
            this.textBox1.BackColor = System.Drawing.SystemColors.WindowFrame;
            this.comboBox1.DataSource = flightClassAr;
            this.comboBox1.SelectedIndex = 0;
            this.comboBox2.Items.Clear();

            if (counter == 19)
            {
                this.button2.Focus();
                this.button1.Enabled = false;
                return;
            }
            else
            {
                int firstClassAvailable = 0;
                int businessClassAvailable = 0;
                string firstClassOnly = "First";
                string businessClassOnly = "Business";
                this.textBox1.Focus();
                for (int i = 0; i < 20; i++)
                {
                    if ((passNameAr[i] == "") & (i < 4))
                    {
                        firstClassAvailable = firstClassAvailable + 1;
                    }
                    else
                        if (passNameAr[i] == "")
                        {
                            businessClassAvailable = businessClassAvailable + 1;
                        }
                }
                if (firstClassAvailable > 1)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (passNameAr[i] == "")
                        {
                            this.comboBox2.Items.Add(seatAr[i]);
                        }
                    }
                }
                if (businessClassAvailable > 1)
                {
                    this.comboBox1.DataSource = firstClassOnly;
                }
                else
                {
                    for (int i = 4; i < 20; i++)
                    {
                        if (passNameAr[i] == "")
                        {
                            this.comboBox2.Items.Add(seatAr[i]);
                        }
                    }
                    if (firstClassAvailable == 0)
                    {
                        this.comboBox1.DataSource = businessClassOnly;
                    }
                }
            }
            this.comboBox1.SelectedIndex = 0;  // needed?
        }

        private void AssignSeat(string name, string seat, int position)
        {            
            passNameAr[position] == name;
            seatAr[position] == seat;
            if (comboBox1.Text == "First")
            {
                numFirstClass = numFirstClass + 1;
            }
            else
            {
                numBusinessClass = numBusinessClass + 1;
            }
            counter = counter + 1;
        }
        private void DisplayPassengerList()
    {
        Array.Sort<string>(passNameAr);        
        richTextBox1.Text += "\nFirst Class Passengers" + numFirstClass + "\t\tBusiness Class Passengers" + numBusinessClass;
        for (int i = 0; i < 20; i++)
        {
            if (passNameAr[i] != "")
            {
                richTextBox1.Text += "\n" + passNameAr[i];
                richTextBox1.Multiline = true;
            }
        }
    }
        private void DisplayManifest()
    {
            this.richTextBox1.Clear();  
            richTextBox1.Text = "\t\t\tP  L  A  N  E      M  A  N  I  F  E  S  T\n\n" +
                "Seat\t\t\tPassenger Name";            
            for (int i =0; i < 20; i++)
            {
           // string strRTF = seatAr[i] + passNameAr[i];
                //  richTextBox1.AppendText(strRTF);
                richTextBox1.Text += "\n" + seatAr[i] + "\t\t" + passNameAr[i];
               // rtxt.Text += "\nFont Family:\t" + Font.FontFamily;
               // rtxt.Text += "\nFont Styles:\t" + Font.Style;
               // rtxt.Text += "\nFont Size:\t" + Font.Size;
               // rtxt.Text += "\nFont Height:\t" + Font.Height;
               // rtxt.Text += "\nFont Units:\t" + Font.Unit;
               richTextBox1.Multiline = true;
              //  rtxt.Dock = DockStyle.Fill;
              //  rtxt.Parent = this;
            }

    }
        public Form1()
        {
            InitializeComponent(); 
            this.comboBox1.DataSource = flightClassAr;
            this.comboBox1.SelectedIndex = 0;
            this.comboBox2.Items.Clear();

            for (int i = 0; i < 4; i++)
            {
                if (passNameAr[i] == "")
                {
                    this.comboBox2.Items.Add(seatAr[i]);
                }
            }
            this.comboBox2.SelectedIndex = 0;
            DisplayManifest();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (activeFlight == true)
            {
                DisplayManifest();
                DisplayPassengerList();
                this.button2.Text = "Start a New Flight";
                activeFlight = false;
                this.button2.Focus();
                this.button1.Enabled = false;
            }
            else
            {
                this.button2.Text = "Close Flight";
                this.button1.Enabled = true;
                Array.Sort<string>(seatAr); 
                // Array.Reverse(array);                
                this.comboBox2.Items.Clear();
                for (int i = 0; i < 4; i++)
                {
                    if (passNameAr[i] == "")
                    {
                        this.comboBox2.Items.Add(seatAr[i]);
                    }
                } 
                this.comboBox2.SelectedIndex = 0;
                numFirstClass = 0;
                numBusinessClass = 0;
                DisplayManifest();
                activeFlight = true;
                this.textBox1.Focus();
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text == "First")
            {
                for (int i = 0; i < 4; i++)
                {
                    if (passNameAr[i] == "")
                    {
                        this.comboBox2.Items.Add(seatAr[i]);
                    }
                }
            }
            else
                for (int i = 4; i < 20; i++)
                {
                    if (passNameAr[i] == "")
                    {
                        this.comboBox2.Items.Add(seatAr[i]);
                    }
                }
            this.comboBox2.SelectedIndex = 0;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("You MUST enter a Passenger Name");
                this.textBox1.Focus();
            }
            else
            {
                    
              int positionInIndex = 0;
              int currentIndex = 0;

              foreach (string aSeatValue in seatAr)
              {
                if (aSeatValue == comboBox2.Text)
                   {
                      positionInIndex = currentIndex;            
                   }
                 currentIndex++;
              }
              AssignSeat(textBox1.Text, comboBox2.Text, positionInIndex);
              DisplayManifest();
              PopulateSeatCombo();
              }
                
        }

       

    }
}

Hmmm...you are saying

passNameAr[position] == name; //passNameAr EQUALS name.
            seatAr[position] == seat;

what you want is the value of name putting in to passNameAr[position].

passNameAr[position] = name; //passNameAr is equal to the value of name
            seatAr[position] = seat;

Argh. Thanks. This is my first go-round with any of the C languages and I sometimes forget when to use "=" and when to use "==" for that matter, I do the same with the Or (| vs ||) and the like.

Thanks for your quick answer.

This question has already been answered. Start a new discussion instead.