Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Windows Forms
 Walkthrough: Creating a Simple Wind...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Windows Forms Programming
Walkthrough: Creating a Simple Windows Form

In this walkthrough you will build and run a simple Windows Form.

NoteNote:

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To create a Windows Form

  1. Start Visual Studio.

  2. Create a Windows Application called HelloWorld. For details, see How to: Create a Windows Application Project.

  3. From the Toolbox, drag a Button control onto the form.

  4. Click the button to select it. In the Properties window, set the Text property to Say Hello.

To write the code for your application

  1. Double-click the button to add an event handler for the Click event. The Code Editor will open with the insertion point placed within the event handler.

  2. Insert the following code:

    Visual Basic
    MessageBox.Show ("Hello, World!")
    
    

    C#
    MessageBox.Show("Hello, World!");
    
    

    J#
    MessageBox.Show("Hello, World!");
    
    

    Visual C++
    MessageBox::Show("Hello, World!");

To test your application

  1. Press F5 to run the application.

  2. When your application is running, click the button and verify that "Hello, World!" is shown.

  3. Close the Windows Form to return to Visual Studio.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker