2 Replies - 2014 Views - Last Post: 02 July 2010 - 11:46 AM Rate Topic: -----

#1 Hunter_wow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-July 10

get Messagebox result

Posted 02 July 2010 - 11:36 AM

Hi. Have google for an hour now but cant find out how to do this correct. The "if" never gets "true":
DialogResult result = MessageBox.Show("Content",
                        "Title",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Warning);
            if (DialogResult.OK == result)
            {
                ....
            }

Any tips? Do I need to add a Eventhandler to the Messagebox? If so, how?

Is This A Good Question/Topic? 0
  • +

Replies To: get Messagebox result

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1632
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: get Messagebox result

Posted 02 July 2010 - 11:42 AM

Try this

if(result == DialogResult.Yes)
{

}



In your code you're putting yes & no buttons, but checking for the return value of OK, which wont exist.
Was This Post Helpful? 3
  • +
  • -

#3 Hunter_wow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-July 10

Re: get Messagebox result

Posted 02 July 2010 - 11:46 AM

Ah, stupid me. Works great. Thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1