I'd like to create a simple confirm dialog saying "Please check the information and if you're sure it's correct, click OK."
Is there something built in like this?
See Question&Answers more detail:osI'd like to create a simple confirm dialog saying "Please check the information and if you're sure it's correct, click OK."
Is there something built in like this?
See Question&Answers more detail:osHere is an example. You can try something like this.
var confirmResult = MessageBox.Show("Are you sure to delete this item ??",
"Confirm Delete!!",
MessageBoxButtons.YesNo);
if (confirmResult == DialogResult.Yes)
{
// If 'Yes', do something here.
}
else
{
// If 'No', do something here.
}
You can also try MessageBoxButtons.OKCancel
instead of MessageBoxButtons.YesNo
. It depends on your requirements.
MessageBoxResult confirmResult = MessageBox.Show("Are you sure to delete this item ??", "Confirm Delete!!", MessageBoxButton.YesNo);`
if (confirmResult == MessageBoxResult.Yes)
{
// If 'Yes', do something here.
}
else
{
// If 'No', do something here.
}