Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form1 : Form
- {
- Label[,] labelki = new Label[4, 4];
- Random los = new Random();
- Label wylosowanyLabel = null;
- public Form1()
- {
- InitializeComponent();
- }
- private void ZmienKolor()
- {
- int i = los.Next(1, 4);
- int j = los.Next(1, 4);
- wylosowanyLabel = labelki[i, j];
- wylosowanyLabel.BackColor = Color.Red; //I get a NullReferenceException here
- }
- private void btnStart_Click(object sender, EventArgs e)
- {
- timer1.Start();
- ZmienKolor();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement