Здесь я создал двумерный массив, в котором данные в текстовом поле должны храниться в выбранном элементе в списке. Он не работает, пожалуйста, помогите мне выбраться из этого кода
public partial class Form1 : Form
{
public TextBox[] tb { get; private set; }
public TextBox[] t { get; private set; }
public TextBox[] t1 { get; private set; }
// TextBox[][] textBoxes = { tb, t, t1 };
public Form1()
{
InitializeComponent();
TextBox[][] textBoxes = { tb, t, t1 };
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 5; j++)
{
textBoxes[i][j] = new TextBox();
}
}
}
private void listBox1_Click(object sender, EventArgs e)
{
TextBox[][] textBoxes = { tb, t, t1 };
int index = listBox1.SelectedIndex;
textBox1.Text = tb[index][0].Text;
textBox2.Text = tb[index][1].Text;
textBox3.Text = tb[index][2].Text;
textBox4.Text = tb[index][3].Text;
textBox5.Text = tb[index][4].Text;
}
private void button1_Click_1(object sender, EventArgs e)
{
int index = listBox1.SelectedIndex;
textBoxes [index][0].Text = textBox1.Text;
textBoxes[index][1].Text = textBox2.Text;
textBoxes[index][2].Text = textBox3.Text;
textBoxes[index][3].Text = textBox4.Text;
textBoxes[index][4].Text = textBox5.Text;
}
}