1
Answer

System.NullReferenceException

Hi

i get the System.NullReferenceException error with this code at line txt[i].Text = i.ToString();

Thanks

 private void button1_Click(object sender, EventArgs e)
        {
            TextBox[] txt = new TextBox[5];
            for (int i = 0; i < 5; i++)
            {
                txt[i].Text = i.ToString();
            }
        }

Answers (1)