6. Hello world message box
Note: While reading this page, bear in mind that I'm no computer expert and that the text below may be partly inaccurate. If you find errors or have proposals for improvements, please send me a message and help make this a better page for the benefit of future visitors. To the left, there are links to more C# tutorials.
To complete this tutorial, follow these instructions:
1. Open Visual C# 2010 Express.
2. Click on New Project in the File menu.
3. Choose Windows Forms Application if that option isn't already chosen, change the name if you like and click on OK.
4. Point at Toolbox in the left margin and click on the Auto Hide icon at the top of the window (to keep the window to stay open and easier to work with).
5. Drag a Button to Form 1.
6. Double-click on the button. The file Form1.cs will open with the caret ready to write code that will run when button 1 is clicked.
7. Write or paste this code where the caret is:
MessageBox.Show("Hello world!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
8. Press F5 to start debugging the program.
9. Click on the button. A message box with the text
Hello world!, the name
Information, the button
OK and the icon
Information should appear.
Would you like to comment on this page or some other page? Use the contact form. Write the title of the page you want to comment on and your comment in the field Message.