title: Global variable won't work in searching in one function
body: <p>I made a program that gets info in textbox1 and textbox2 after pressing button1. 
  If you type in textbox3 and if what you wrote there is same as textbox1 ,After pressing button2 it puts textbox2's text in the label2.text.</p>
  
  <p>But the problem is that it won't put the textbox2.text into label2.text.
  Why?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
      ozv[] a = new ozv[5];
      int i = 0;
      private void button1_Click(object sender, EventArgs e)
      {
          a[i] = new ozv();
          a[i].name = textBox1.Text;
          a[i].id = int.Parse(textBox2.Text);
          i++;
      }
  
      private void button2_Click(object sender, EventArgs e)
      {
          for (int j = 0; j &lt; 5; j++)
          {
              a[j] = new ozv();
              if (a[j].name == textBox3.Text)
              {
                  label2.Text = a[j].id.ToString();
              }
          }
      }
  }
  </code></pre>
  
  <p>And here's the class I made:</p>
  
  <p>class ozv
      {
          public string name;
          public int id;
      }</p>