Home » .Net » C#.Net » C#.Net Windows Development

Develop a windows application in C#

In this article, we are going to learn how to develop a windows application in C#.Net? Here, we are writing the steps to create a windows application using C# in Visual Studio.
Submitted by IncludeHelp, on August 28, 2018

To develop windows application, we need to using studio and follow some steps:

Step 1) First of all we launch visual studio.

Develop a windows application in C# 1

Step 2) Goto fie menu and select new project.

Develop a windows application in C# 2


Step 3) Now we select "Visual C#" from left panel and select "Windows Forms Application" and give appropriate name to our application. Here I provided name "MyWinApp".

Develop a windows application in C# 3

Step 4) Then A default generated form will appear in our application, like this:

Develop a windows application in C# 4


Here we have following things:

  1. ToolBox
    It contains tool to develop the application.
  2. Solution Explorer
    It contains our project detail; it shows all files related to our project.
  3. Property window
    Using property window we can change the properties of controls which are used in our application.

Building the solution

We can build our project or solution using build menu or shortcut key: Ctrl + Shift +B.

Execution of Application

We can execute our application with or without debugging. Here, we use debug menu or it can also be done by using shortcut key: F5 or CTRL+F5.

Design an application to display "Hello World" message on MessageBox by clicking on button control

First of all, we create a windows application. And then drag and drop a button from toolbox to container form.

Develop a windows application in C# 5


We can change the name, color and text etc of any control using property window, here we change our form text to "My First Windows Application" and button text to "Click Me".

Now, we wrote code on button's click event, we can generate sample code for click event by "double click" on the button. Then the generated code will we like this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MyWinApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }
    }
}

Here button1_Click function will use as a click event, here we can write code what we want to do on click event on the button. Now we wrote code to show MessageBox to display "Hello World".

private void button1_Click(object sender, EventArgs e)
{
     MessageBox.Show("Hello World");
}

Execute application using CTRL+F5. Here is the output after clicking on the button "Click Me":

Develop a windows application in C# 6







Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.