closing a form/dialog
-
Hi, I asked this question before in the VC++ forum, but I think my question was misunderstood. I´ll try it again with more explanation... I´m making an Windows Form appl. using VC++ .Net 2003. As I start an "Form" is automatically created for me. Then I want to make my own "MessageBox"-like class (due to interference with the "windows.h" header I cannot use the included MessageBox" properly.) I go to Project->Add new Item->Windows Form (.NET) and a new "Form" is created, that I want to use as a dialog box, and I add a Label and an OK-button rto it. In the Forms properties I set: FormBorterStyle = FixedDialog MaximizeBox = False MinimizeBox = False However, I don´t know which property I must set, or which method to call for making the Form close when I push the OK-button. Does anybody have a suggestion? (I display it by calling the ShowDialog() method.) Apart from that it works as a dialogbox (I know there are probably better ways to solve the problem, but I´m quite new to VC/C++, and this seemed like the easiest way around it) regards doneirik
-
Hi, I asked this question before in the VC++ forum, but I think my question was misunderstood. I´ll try it again with more explanation... I´m making an Windows Form appl. using VC++ .Net 2003. As I start an "Form" is automatically created for me. Then I want to make my own "MessageBox"-like class (due to interference with the "windows.h" header I cannot use the included MessageBox" properly.) I go to Project->Add new Item->Windows Form (.NET) and a new "Form" is created, that I want to use as a dialog box, and I add a Label and an OK-button rto it. In the Forms properties I set: FormBorterStyle = FixedDialog MaximizeBox = False MinimizeBox = False However, I don´t know which property I must set, or which method to call for making the Form close when I push the OK-button. Does anybody have a suggestion? (I display it by calling the ShowDialog() method.) Apart from that it works as a dialogbox (I know there are probably better ways to solve the problem, but I´m quite new to VC/C++, and this seemed like the easiest way around it) regards doneirik
I believe if you call the button IDOK, it will do this for you. If not, then there's a property for what button is the OK button, but the name escapes me. At least, that's the case in C#. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
-
Hi, I asked this question before in the VC++ forum, but I think my question was misunderstood. I´ll try it again with more explanation... I´m making an Windows Form appl. using VC++ .Net 2003. As I start an "Form" is automatically created for me. Then I want to make my own "MessageBox"-like class (due to interference with the "windows.h" header I cannot use the included MessageBox" properly.) I go to Project->Add new Item->Windows Form (.NET) and a new "Form" is created, that I want to use as a dialog box, and I add a Label and an OK-button rto it. In the Forms properties I set: FormBorterStyle = FixedDialog MaximizeBox = False MinimizeBox = False However, I don´t know which property I must set, or which method to call for making the Form close when I push the OK-button. Does anybody have a suggestion? (I display it by calling the ShowDialog() method.) Apart from that it works as a dialogbox (I know there are probably better ways to solve the problem, but I´m quite new to VC/C++, and this seemed like the easiest way around it) regards doneirik
For your MessageBox problem... In stdafx.h just add #undef MessageBoxA or MessageBox don't remember. To close your dialog take a look at this and I'm going to help you a bit... // Set the accept button of the form to button1. form1->AcceptButton = button1;