beno1990
October 24th, 2008, 12:11 AM
Hello! I'm a programmer coming from a mostly procedural programming background but I'm learning C# as I go in MonoDevelop.
But there's one thing I can't seem to get and it's bugging me, is if I want to control a window other than the active window. For example, a dialog box popup which asks you to confirm that you want to continue. If I want the dialog box *and* the parent window to close when I click ok, I can't seem to access the parent window, eg:
protected virtual void btnOk_clicked (object sender, System.EventArgs e)
{
MainWindow.Destroy(); //doesn't work
this.Destroy(); //works fine
}
Is there a way to control another class like that which I don't know of?
Thanks for reading this.
But there's one thing I can't seem to get and it's bugging me, is if I want to control a window other than the active window. For example, a dialog box popup which asks you to confirm that you want to continue. If I want the dialog box *and* the parent window to close when I click ok, I can't seem to access the parent window, eg:
protected virtual void btnOk_clicked (object sender, System.EventArgs e)
{
MainWindow.Destroy(); //doesn't work
this.Destroy(); //works fine
}
Is there a way to control another class like that which I don't know of?
Thanks for reading this.