For Developers

Confirmation box in c# windows application

To make a confirmation box in c# windows application we can use

MessageBox.Show(string text,string caption,MessageBoxButtons buttons)

Coding :


if (MessageBox.Show(”Do you want to delete?”, “Confirm delete”,MessageBoxButtons.YesNo) == DialogResult.Yes)
{
MessageBox.Show(”Deleted”);
}


In the above coding when a button delete is clicked a condition is checked and confirmation box "Do you want to delete" is arised with two buttons 'Yes' and 'No'.If 'Yes' is clicked then another message box "Deleted" is showed.

0 comments:

Post a Comment