C Sharp Windows Form Application
- 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.
Say Helloby 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");
}
}
}
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");
}
}
}
C Sharp Windows Form Application
Reviewed by LanguageExpert
on
August 10, 2017
Rating:
No comments