Thursday, 9 August 2012

How to create customized Message Box in c# with "OK", "CANCEL" buttons.

How to create customized Message Box in c# with "OK", "CANCEL"  buttons.



In this tutorial i will tell you about how to fully utilize the MessageBox in C#.

Besides being used as unofficial Code Testing tool, it can be well used for confirmations before a particular action is being performed, like closing an form or updating the content of a critical text box. This is most helpful to get a quick confirmation from the user side.

The sample code for confirmation of form close event using a message box is is



When initialized at form closing event , this code will pop-up a message box With two buttons  - Yes and NO. If Yes is clicked, the result code "Application.Exit();" will be performed. You can manipulate the code triggering event and result code to be performed by using IF and ELSE IF statements for "YES"  or "NO" clicked

No comments:

Post a Comment

Don't Copy Contents!

//infolinks