| | |
MessageBox with OK and CancelButton
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
I am trying to create a DialogBox in C++ .NET with both an "OK" button and a "Cancel" Button.
I know how to just show a MessageBox with an "OK" button like this:
I know how to just show a MessageBox with an "OK" button like this:
C++ Syntax (Toggle Plain Text)
MessageBox::Show(this, "Message");
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
•
•
•
•
I am trying to create a DialogBox in C++ .NET with both an "OK" button and a "Cancel" Button.
I know how to just show a MessageBox with an "OK" button like this:
C++ Syntax (Toggle Plain Text)
MessageBox::Show(this, "Message");
C++ Syntax (Toggle Plain Text)
MessageBox::Show(this, "Message", MB_OKCANCEL);
Last edited by Jennifer84; Mar 4th, 2008 at 5:42 pm.
•
•
Join Date: Nov 2007
Posts: 980
Reputation:
Solved Threads: 210
Something like this ...
C++ Syntax (Toggle Plain Text)
MessageBox::Show(this, "OK to proceed?", "A caption here ...", MessageBoxButtons::OKCancel, MessageBoxIcon::Question);
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
Thank you. That worked well.
As it is my first time I use an OKCANCEL dialogbox, I might wonder how it will
be possible to tell if the user ex. pressed the OK button or the CANCEL button.
Ex:
Thank you...
As it is my first time I use an OKCANCEL dialogbox, I might wonder how it will
be possible to tell if the user ex. pressed the OK button or the CANCEL button.
Ex:
C++ Syntax (Toggle Plain Text)
if (OK is pressed) //What will be written on this line for OK or CANCEL { Action Here; }
Thank you...
•
•
•
•
Something like this ...
C++ Syntax (Toggle Plain Text)
MessageBox::Show(this, "OK to proceed?", "A caption here ...", MessageBoxButtons::OKCancel, MessageBoxIcon::Question);
•
•
Join Date: Nov 2007
Posts: 980
Reputation:
Solved Threads: 210
C++ Syntax (Toggle Plain Text)
System::Windows::Forms::DialogResult result = MessageBox::Show(this, "OK to proceed?", "A caption here ...", MessageBoxButtons::OKCancel, MessageBoxIcon::Question); if(System::Windows::Forms::DialogResult::OK == result) { // OK button } else { // System::Windows::Forms::DialogResult::Cancel == result // Cancel button }
![]() |
Other Threads in the C++ Forum
- Previous Thread: extracting info to another array
- Next Thread: Completing User defined function
Views: 1937 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll dynamic encryption error file forms fstream function functions game givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort stream string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





