Hi everyone. Admittedly I am new with programming but I am learning.
Anyway, I am currently doing a project for school which needs multiple screens to be linked and switch to the next screen after a certain action is performed. I have been trying to get the first screen to load, click the button, then display the 2nd screen while hiding the 1st screen. Currently I am stuck with a System.StackOverflowException unhandled exception and currently I have been unable to fix it. Also I am currently using Visual Studio 2015.
Here is my code:
public
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
public void Form1_Load(object sender, EventArgs e)
{
var blah = 1;
List<int> aList = new List<int>();
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
for (int i = 0; i < 10; i++)
{
aList = (blah * 5);
Console.WriteLine("Array List = " + aList + " : Loop number = " + i + " : var number = " + blah);
blah += 1;
}
}
Form1 form1 = new Form1();
Form2 form2 = new Form2();
private void button1_Click_1(object sender, EventArgs e)
{
form2.Show();
form1.Hide();
}
}
}
Thanks
Anyway, I am currently doing a project for school which needs multiple screens to be linked and switch to the next screen after a certain action is performed. I have been trying to get the first screen to load, click the button, then display the 2nd screen while hiding the 1st screen. Currently I am stuck with a System.StackOverflowException unhandled exception and currently I have been unable to fix it. Also I am currently using Visual Studio 2015.
Here is my code:
public
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
public void Form1_Load(object sender, EventArgs e)
{
var blah = 1;
List<int> aList = new List<int>();
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
aList.Add(0);
for (int i = 0; i < 10; i++)
{
aList = (blah * 5);
Console.WriteLine("Array List = " + aList + " : Loop number = " + i + " : var number = " + blah);
blah += 1;
}
}
Form1 form1 = new Form1();
Form2 form2 = new Form2();
private void button1_Click_1(object sender, EventArgs e)
{
form2.Show();
form1.Hide();
}
}
}
Thanks