Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.



  • Please log in to reply
No replies to this topic

#1 frankblourtango


  • Members
  • 63 posts
  • Gender:Male
  • Location:philly
  • Local time:10:05 PM

Posted 25 January 2008 - 07:43 AM

I'm trying to use an OKCancel Messagebox in Visual C++ in an Exit button.

I can't figure out how to take the user clicking the OK button in a IF statement to quit the program using Close();

Here is what I have where it tells me what the user clicked, but how can I use this to actually test for the OK button and Close() ?

I've tried a string compare but I'm too much of a novice to pull it off

private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {

Windows::Forms::DialogResult buttonClicked;buttonClicked = MessageBox::Show("click a button","what",MessageBoxButtons::OKCancel);

MessageBox::Show(String::Concat( "you clicked the ", buttonClicked, " button")) ;

Edited by frankblourtango, 25 January 2008 - 07:44 AM.

BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users