Introduction Windows From Application In C#




Writing ‘Hello World’ Program as a desktop application

Now we will create a very simple desktop application. In this application, user will click on a button ‘Show’ and a messagebox (a small window) will appear displaying ‘Hello World’.

Steps:
1.      Start Microsoft Visual Studio 2013
2.      Click File>New>Project
3.      Select Windows>Windows Forms Application
4.      Give an appropriate name
5.      Click ‘Ok’ button

 You will get the following picture in your window
     
           
6.      Now drag and drop a button from toolbox situated at the left side of your development window .(if it is not appeared there, Click View>ToolBox)­
7.      Click on the button
8.      Change the Text Property of the button into ‘Show’



This will looks like the following picture.

     

9.      Double click on the button of the form and write the following code snippet
     private void button1_Click(objectsender, EventArgs e)
     {
         MessageBox.Show("Hello World");
  }

10.  Now run the application by clicking on the debug button or pressing F5
11.  Click on the ‘Show’ button of the running application
12.  A messagebox will appear. You will get the following picture


      


Well done!!! J We have completed the Hello World program in C#. Let’s see the details of Visual Studio 2013, an Integrated Development Environment:

إرسال تعليق

أحدث أقدم