Thursday, 29 November 2012

C# MessageBox

Use Of C# MessageBox :

             Displays a message box that can contain text, buttons, and symbols that inform and notify the user.

 

We Create C# Window Application That Display MessageBox When User Click On Button

 

  1. Create Window Application

  2. Drag Button Control From Toolbox And Drop On Form

  3. Set Property Of Button Control From Property Window Like :

    Text = Hello Message

    Name = BTN_MSG

    4.  Generate "Hello Message" Button Of Click Event

 

               From Property Window Select Event And Double Click On "Click"


 5.  MessageBox Codding

 

private void BTN_MSG_Click(object sender, EventArgs e)
{
       MessageBox.Show("Hello Message", "Hello",MessageBoxButtons.OK,MessageBoxIcon.Information);
}

Here,
"Hello Message" Means Body Of MessageBox
"Hello" Means Title Of MessageBox
 MessageBoxButtons.OK Means Which Button Display On MessageBox
MessageBoxIcon.Information Means Display Information Icon With MessageBox

6. Run Program Press F5

 

7.  Output

No comments:

Post a Comment