I have a form called form1 with controls which are created during run-time.
When I press a button on the Form another Form loads called combat and form1 is hidden so that only 1 form (combat) is visible.
When I press a button on combat I want my form1 form the be shown. However I can’t access it.
Here is what I’ve tried:
private void combatBtn_Click(object sender, EventArgs e)
{
Form combat = new Combat(this);
this.Hide();
combat.Show();
}
public partial class Combat : Form
{
public Combat(Form form)
{
InitializeComponent();
form.Show();
}
private void button1_Click(object sender, EventArgs e)
{
form.Show();
}
}
1 Answer