When I make the seats[] seatArray
, and try to run it, I get an error
NullReferenceException was unhandled. Object Reference not set to an instance of an object.
I think it's my printinfo function at the end.
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
Seats s = new Seats();
//Seats[] seatArray = new Seats[14]; //HEREEE
public Form1()
{
InitializeComponent();
listBox2.Items.Add("ROW# A B C D E F");
listBox2.Items.Add(" 1 " + s.PrintInfo);
// listBox2.Items.Add( seatArray[0].PrintInfo); //HEREEE
listBox1.Items.Add("Seats Filled:");
listBox1.Items.Add("Windows Available:");
listBox1.Items.Add("Regular Meals:");
listBox1.Items.Add("LowCal Meals:");
listBox1.Items.Add("Veget Meals:");
}
private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
{
string test = listBox2.SelectedItem.ToString(); /
//string[] div = Regex.Split(test, " ");
//textBox2.Text = div[0];
textBox2.Text = test; //
}
}
public class Seats //
{
public char A;
public char B;
public char C;
public char D;
public char E;
public char F;
public Seats()
{
A = '.';
B = '.';
C = '.';
D = '.';
E = '.';
F = '.';
}
public char Aa
{
set { A = value; }
get { return A; }
}
public char Bb
{
set { A = value; }
get { return A; }
}
public char Cc
{
set { C = value; }
get { return C; }
}
public char Dd
{
set { D = value; }
get { return D; }
}
public char Ee
{
set { E = value; }
get { return E; }
}
public char Ff
{
set { F = value; }
get { return F; }
}
public string PrintInfo //
{
get { return this.A + " " + this.B + " " + this.C + " " + this.D + " " + this.E + " " + this.F; }
}
}
}