Help with MessageBoxes

This is a discussion on Help with MessageBoxes within the Windows Programming forums, part of the Platform Specific Boards category; greetings to all, i created a form (EletronicDiary) which has a button to open another form(Add New Appointment) --> Code: ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    10

    Help with MessageBoxes

    greetings to all,

    i created a form (EletronicDiary) which has a button to open another form(Add New Appointment) -->
    Code:
    Appointment_AddScreen^ addApointForm = gcnew Appointment_AddScreen();
    			addApointForm->ShowDialog();
    when i click on CANCEL, a messageBox appears to cofirm my decision(with buttons YES NO). My problem is no matter my decision of Yes or No, the add new appointment form closes. Please i need advice on what to do so that when i click on NO, my form doesnt close. Below is the code
    Code:
    private: System::Void btnAddCancel_Click(System::Object^  sender, System::EventArgs^  e) {
    			 System::Windows::Forms::DialogResult result;
    			 result = MessageBox::Show("Are you sure you want to exit?\nUnsaved entries will be lost!","Confirm Exit",MessageBoxButtons::YesNo,MessageBoxIcon::Warning);
    
    			 if (result == System::Windows::Forms::DialogResult::Yes)
    				{
    					this->Close();
    				}
    		 }
    attached is an image for futher clarification

    NB even if the IF statement is not present, the form still closes after Yes or No is clicked
    Attached Images Attached Images  

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Messageboxes will work in win2k, fail in XP
    By Rippy in forum Windows Programming
    Replies: 10
    Last Post: 02-22-2008, 09:36 PM
  2. Messageboxes in other languages
    By Magos in forum Windows Programming
    Replies: 2
    Last Post: 09-01-2005, 01:31 PM
  3. Preventing multiple MessageBoxes
    By the dead tree in forum Windows Programming
    Replies: 5
    Last Post: 04-19-2004, 08:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21