Picture box always throws object reference not set to instance of object error
<p>I have a class which holds a picturebox. I have created an array of objects of my class, but when I try to create a new picture box, I am getting an error stating, object reference is not set to an instance of object. </p>

<p>Here is how I am creating pictureboxes</p>

<pre><code> GreyHound[] dog;

    public Form1()
    {
       InitializeComponent();
       dog[1].MyPictureBox = new PictureBox();
       dog[1].MyPictureBox = pictureBox1;

       dog[2].MyPictureBox = new PictureBox();
       dog[2].MyPictureBox = pictureBox2;

       dog[3].MyPictureBox = new PictureBox();
       dog[3].MyPictureBox = pictureBox3;

       dog[4].MyPictureBox = new PictureBox();
       dog[4].MyPictureBox = pictureBox4;
</code></pre>

<p>Edited Code :</p>

<p>GreyHound[] dog;</p>

<pre><code>    public Form1()
    {

       InitializeComponent();
       dog = new GreyHound[4];
       dog[0].MyPictureBox = new PictureBox();
       dog[0].MyPictureBox = pictureBox1;

       dog[1].MyPictureBox = new PictureBox();
       dog[1].MyPictureBox = pictureBox2;

       dog[2].MyPictureBox = new PictureBox();
       dog[2].MyPictureBox = pictureBox3;

       dog[3].MyPictureBox = new PictureBox();
       dog[3].MyPictureBox = pictureBox4;



    }
</code></pre>
