Tuesday, 4 June 2013

How to use MessageBox object control in Windows phone for any question using c# code

How to use MessageBox object control in Windows phone for any question  using c# code (ok , Cancel)



Step 1 : First create your windows phone application it's may be 7.0,7.1,8.0 application.

Step2: Open MainPage.xaml code file .

Step 3 : Import below code file.

 using  System.Windows;

Step 4 : Paste below code to show message box in windows phone this is simple info message box which will show only message to use not asking any question.
 
MessageBox.Show("Message to show user","Title of Message Box",MessageBoxButton.OK);

Step 5 : Ask question to user and wait for his reply

MessageBoxResult result =MessageBox.Show("Are you male", "Gender Question", MessageBoxButton.OKCancel);

Step 6 : Check user answer using result object

if (object == MessageBoxResult.Ok)
{
       //user is male

else
{
      // cancel part
}

Step 4 : This way you can use message box in windows phone .



No comments:

Post a Comment

Thank you for your interest .