Hi, what is it that you would like to do exactly?
Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474
Did you think about something like this:
PS: code is meant to work with 2 forms (form2, and form3). If you want for, add 2 more.
public partial class Form1 : Form
{
Form[] forms;
Form2 f2;
Form3 f3;
int counter;
public Form1()
{
InitializeComponent();
forms = new Form[] { f2, f3 };
}
private void buttonFor_Click(object sender, EventArgs e)
{
if (counter < forms.Length)
{
CommonMethod();
counter++;
}
}
private void buttonBack_Click(object sender, EventArgs e)
{
if (counter > 0)
{
counter--;
CommonMethod();
}
}
private void CommonMethod()
{
for (int i = 0; i < forms.Length; i++)
{
if (forms[i] == null)
{
if (i == 0)
{
f2 = new Form2();
forms[i] = f2;
}
else
{
f3 = new Form3();
forms[i] = f3;
}
}
if (counter == i)
{
forms[i].Location = new Point((this.Location.X + this.Width + 10), this.Location.Y);
forms[i].Show();
}
else
forms[i].Hide();
}
}
}
There is some work to be done, but this is working approximatelly.
Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474