I\'m making a seat booking system in vb.net (WinForms) and I need the user to be able to select the seat they wish to use and for it to change colour (so they can tell that it s
Try this:
 private void Form1_Load(object sender, EventArgs e)
        {
            int index;
            Button[] b=new Button[500];
            for(int i=0;i<24;i++)
            for(int j=0;j<20;j++)
            {
                index = (20 * i) + j;
                b[index]=new Button();
                b[index].Text=index.ToString();
                b[index].Location=new Point(j*80,i*30);
                panel1.Controls.Add(b[index]);
                b[index].Click += new EventHandler(ButtonLeft_Click);    
             }
            }
        private void ButtonLeft_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;
            if (b.BackColor == Color.Black)
                b.BackColor = Color.White;
            else
                b.BackColor = Color.Black;
              //DB Commands here    
        }