C Sharp Windows Form Application

Here , In this post We are going to be introduced the Windows Form Application in C Sharp Visual Studio. Steps To follow






  • Open Visual Studio.

  • Click on new Project.

  • Select Windows Forms Application from the templates.





  • Name the Application and select Location where to save it.

  • Click on Ok

  • A Form will appear.

  • It is a design form where you can drag and drop controls from the tool bar on left side of window.

  • To open a coding windows press f7 key on laptop/desktop. Or right click on form and click on view code.

The coding windows will appear.



Coding

Drag the button control from the left side toolbox. Click on button and name the button Say Hello by editing it's Properties. Located on right side.




Double click on the button will open the coding window. It will automatically write the click event code for you. Write the below code.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApplication1

{

        public partial class Form1 : Form

        {

        public Form1()

        {

            InitializeComponent();

        }

        private void button1_Click(object sender, EventArgs e)

        {

            MessageBox.Show("Hello C Sharp");

        }

        }

}



Output

C Sharp Windows Form Application C Sharp Windows Form Application Reviewed by LanguageExpert on August 10, 2017 Rating: 5

No comments