i have a main form where i can set settings and show some stuff inlcuding a "MenuStrip" and a second form that opens upon clicking "Add" Button in Form 1.
In The 2. Form the user can add multiple strings to text boxes. After clicking "Done" in Form 2 all the Informationes will be saved in an multidimensional array [,].
The form 1 then retrieves these Informations with get/set.
The Problem: I am getting an Infinite Loop on the get methode =/ I think it is because i have not defined how many columns/rows the array has (which is impossible since the user can add more informations dynamcally). So maybe i have to pass the reference (and how do i manage that? i know how to pass things between forms when CREATING an instance of a new form but not when the old form is already open and i close the 2nd one) or is there any other way?
My Code:
//in Form 1
private void btn_Add_Click(object sender, EventArgs e)
{
using (form2 = new AddStuff())
{
form2.ShowDialog();
string [,] copy = form2._NewMenuStrip.Clone() as string [,];
for (int i = 0; i < copy.GetLength(0);i++ )
{
for (int j=0; j < copy.GetLength(1);j++)
{
MessageBox.Show(copy[i, j]);
}
}
}
}
//in Form 2
public string [,] _NewMenuStrip
{
get { return _NewMenuStrip; } // Here i get the infinite Loop
set { _NewMenuStrip = value;}
}
private void btn_Done_Click(object sender, EventArgs e)
{
WriteInformationToArray();
this.Close();
}
Thanks in Advance!
Regards, Christian