Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box 2

Status
Not open for further replies.

besto1a

Programmer
Aug 20, 2006
41
GB
How do i use a value returned by a message box, ie, YesNO.

I know how to do dthis in VB, uiosng the VByes/VBno. But how do you od it in C#
 
DialogResult dl1 = MessageBox.Show("question", "caption", MessageBoxButtons.YesNo);
if (dl1 == DialogResult.Yes)
{
// code for yes
}
else
{
// code for no
}
 
or to save time:

if (
MessageBox.Show(this, "question", "caption", MessageBoxButtons.YesNo) == DialogResult.Yes
)
{
}
else
{
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top