Software Development Network>> Windows Forms>> Form question
You can do this by creating a couple of properties and methods on the two forms, like the following:
public class Form1{ public void Form2Done() { OpenForm2Button.Enabled = true; }
private void OpenForm2Button_Click(object sender, EventArgs e) { OpenForm2Button.Enabled = false; Form2 form = new Form2(); form.OpeningForm = this; form.Show(); }}
public class Form2{ public Form1 OpeningForm; private void Form2_OnClosing(object sender, EventArgs e) { if (OpeningForm != null) OpeningForm.Form2Done(); }}
Naturally, you'll have to hook up the events to the event handlers that I've created.
Hope that helps.
Form question
Arran Siu
You can do this by creating a couple of properties and methods on the two forms, like the following:
public class Form1
{
public void Form2Done()
{
OpenForm2Button.Enabled = true;
}
private void OpenForm2Button_Click(object sender, EventArgs e)
{
OpenForm2Button.Enabled = false;
Form2 form = new Form2();
form.OpeningForm = this;
form.Show();
}
}
public class Form2
{
public Form1 OpeningForm;
private void Form2_OnClosing(object sender, EventArgs e)
{
if (OpeningForm != null)
OpeningForm.Form2Done();
}
}
Naturally, you'll have to hook up the events to the event handlers that I've created.
Hope that helps.
John Sorensen
Thanks
Jon