Message box

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

I need to create a message box with 2 options (Yes or No), and then be
able to respond to whichever option is selected. What would be the best
way to do this in C#?
 
Mike P explained :
I need to create a message box with 2 options (Yes or No), and then be
able to respond to whichever option is selected. What would be the best
way to do this in C#?

see MessageBox.Show() and various overloads

Hans Kesting
 
Is that only available in Winforms apps? I am looking to create a
message box for a webpage.
 
Well, the simplest is window.confirm, but that typically gives you
ok/cancel, not yes/no. You could perhaps use DHTML to display a div for
this though; I'm sure the AJAX Control Toolkit has some similar examples.

Marc
 
I need to create a message box with 2 options (Yes or No), and then be
able to respond to whichever option is selected. What would be the best
way to do this in C#?

*** Sent via Developersdexhttp://www.developersdex.com***

DialogResult result = MessageBox.Show("This is my message for YES and
NO","This is title something like App name",MessageBoxButtons.YesNo);

if (result == DialogResult.Yes)
{
MessageBox.Show("Clicked YES");
}
if (result == DialogResult.No)
{
MessageBox.Show("Clicked NO");
}

I hope this snippet will help

-Cnu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top