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.
But the problem is that it won't put the textbox2.text into label2.text. Why?
Here's the 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 < 5; j++)
{
a[j] = new ozv();
if (a[j].name == textBox3.Text)
{
label2.Text = a[j].id.ToString();
}
}
}
}
And here's the class I made:
class ozv { public string name; public int id; }