How can I call this array that initializes on a button click event:
private void button1_Click(object sender, EventArgs e)
{
int[] n = textBox1.Text.Split(' ').Select(int.Parse).ToArray();
richTextBox1.Text += "Entered values: ";
foreach (int num in n)
{
richTextBox1.Text += num + " ";
}
richTextBox1.Text += "\n";
}
to other parts of an array, say another click event.
I have tried declaring the array in the form class but that requires the array to have a pre-defined size which is problematic for other parts of the code.
EDIT: Solved! Thanks to the guys at stackoverflow. Solutions and comments were very helpful :D