No, that wont work - you need the current instance of the main form, not a new one.
What you have tried to do is put your mobile phone in the glove box of your car, then expect to be able to open the glove box in my car and find your phone.
It is possible - if you hand an instance of the main form to the second when you open it, but it is a very bad idea - it locks the design of the two forms together, so you can't use form2 without the main form, or change the main form without considering teh effects on form2. This is against the principles of OOP and considered very bad practice.
Instead, construct an event in form2 which the main form subscribes to when it creates it. When the event is signalled, the main form can then hide it's own button, or take whatever other measures it sees fit.
It's pretty easy to do. In form2:
public event EventHandler DisableOperation;
protected virtual void OnDisableOperation(EventArgs e)
{
EventHandler eh = DisableOperation;
if (eh != null)
{
eh(this, e);
}
}
private void DoSomethingToDisableOperation()
{
OnDisableOperation(null);
}
In your main form:
private void ShowChildForm()
{
frmChild fd = new frmChild();
fd.DisableOperation += new EventHandler(DisableOperation);
fd.ShowDialog();
}
private void DisableOperation(object sender, EventArgs e)
{
myButton.Enabled = false;
}