Get Started with .NET Framework

Your first steps into building powerful Windows applications with the .NET Framework.

What is .NET Framework?

.NET Framework is a software development framework developed by Microsoft that runs primarily on Microsoft Windows. It includes a large and comprehensive class library called the Framework Class Library (FCL) and supports multiple programming languages such as C#, Visual Basic, and F#.

Prerequisites

Before you begin, ensure you have the following installed:

  • Visual Studio: The integrated development environment (IDE) for .NET development. We recommend Visual Studio 2022. Download Visual Studio
  • .NET Framework SDK: Typically included with Visual Studio, but you can also download it separately.

Step-by-Step: Your First .NET Framework Application

1

Create a New Project

Open Visual Studio and select "Create a new project".

Search for "Windows Forms App (.NET Framework)". Make sure to select the one that specifies ".NET Framework" in its name and description.

Click "Next".

Visual Studio New Project Window
2

Configure Your Project

In the "Configure your new project" dialog, provide a project name (e.g., "MyFirstDotNetApp") and a location for your project.

Click "Create".

Visual Studio Configure Project
3

Design Your Form

Visual Studio will open the default Form (e.g., `Form1.cs` or `Form1.vb`) in the designer.

From the Toolbox (View > Toolbox), drag and drop a Button and a Label onto the form.

In the Properties window (View > Properties Window):

  • Select the Button. Change its `Text` property to "Click Me".
  • Select the Label. Clear its `Text` property.
Visual Studio Form Designer
4

Add Event Handling Code

Double-click the "Click Me" button on the form. This will automatically open the code-behind file (e.g., `Form1.cs`) and create an event handler for the button's `Click` event.

Inside the button's click event handler, add the following code:


// Example for C#
label1.Text = "Hello, .NET Framework!";
                        

If you're using Visual Basic, the code would look like this:


' Example for Visual Basic
Label1.Text = "Hello, .NET Framework!"
                        
5

Run Your Application

Press F5 or click the "Start" button (the green play icon) in the Visual Studio toolbar to build and run your application.

Click the "Click Me" button. The label should update to display "Hello, .NET Framework!".

Running Application Output

Next Steps

Congratulations! You've just created and run your first .NET Framework application.

  • Explore other controls in the Toolbox.
  • Learn about .NET Framework classes and methods in the Developer's Guide.
  • Discover different application types like WPF and ASP.NET.