Walkthrough: Creating a Simple Windows Form
Visual Studio .NET 2003
In this walkthrough you will build and run a simple Windows Form.
To create a Windows Form
- Start Visual Studio.
- Create a Windows Application called HelloWorld. For details, see Creating a Windows Application Project.
- From the Toolbox, drag a Button control onto the form.
- Click the button to select it. In the Properties window, set the Text property to "Say Hello".
To write the code for your application
- Double-click the button to add an event handler for the Button1 Click event. The Code Editor will open with the insertion point placed within the event handler.
- Insert the following code:
' Visual Basic MessageBox.Show ("Hello, World!") // C# MessageBox.Show("Hello, World!"); // C++ MessageBox::Show("Hello, World!");
To test your application
- Press F5 to run the application.
- When your application is running, click the button and verify that "Hello, World!" is shown.
- Close the Windows Form to return to Visual Studio.