B
bj7lewis
I have two modal dlg forms that are invoked(seperately) by a main form but
the two modal dlg forms don't close when clicking the OK & Cancel buttons
setup as below...
Here the setup...
//In MainForm.cs...
//I Don't want the main form to close with enter and esc keys...
MainForm.AcceptButton = None; //Not in code...
MainForm.CancelButton = None; //Not in code...
//I use ExitApp button to exit app...
....
void ExitApp_Click(...)
{
Close();
}
//In My1stDlgForm.cs...
//I Do want the main form to close with enter and esc keys...
OKDlgButton.DialogResults = ....OK;
CancelDlgButton.DialogResults = ....Cancel;
....
My1stDlgForm.AcceptButton = OKDlgButton;
My1stDlgForm.CancelButton = CancelDlgButton;
//In My2ndDlgForm.cs...
//I Only want the form to close with enter keys...
OKDlgButton.DialogResults = ....OK;
....
My2ndDlgForm.AcceptButton = OKDlgButton;
My2ndDlgForm.CancelButton = ...None;
Note: End of codes above...
The program builds and runs but doesn't close. I have other C# programs that
the button worked and check the codes above with the old program an
everything matchs up...
Where else do I look to set this up...
Any help...
the two modal dlg forms don't close when clicking the OK & Cancel buttons
setup as below...
Here the setup...
//In MainForm.cs...
//I Don't want the main form to close with enter and esc keys...
MainForm.AcceptButton = None; //Not in code...
MainForm.CancelButton = None; //Not in code...
//I use ExitApp button to exit app...
....
void ExitApp_Click(...)
{
Close();
}
//In My1stDlgForm.cs...
//I Do want the main form to close with enter and esc keys...
OKDlgButton.DialogResults = ....OK;
CancelDlgButton.DialogResults = ....Cancel;
....
My1stDlgForm.AcceptButton = OKDlgButton;
My1stDlgForm.CancelButton = CancelDlgButton;
//In My2ndDlgForm.cs...
//I Only want the form to close with enter keys...
OKDlgButton.DialogResults = ....OK;
....
My2ndDlgForm.AcceptButton = OKDlgButton;
My2ndDlgForm.CancelButton = ...None;
Note: End of codes above...
The program builds and runs but doesn't close. I have other C# programs that
the button worked and check the codes above with the old program an
everything matchs up...
Where else do I look to set this up...
Any help...