Hello and welcome to this video.
In this video I'll be creating a very basic Windows form application using C sharp and Visual Studio
to begin let's open of Visual Studio.
So click on my start menu and then locate the features judicial icon which is this icon here features
to 2019.
I'm gonna click on it from the Visual Studio start screen.
I'm going to click on the link to create a new project inside the search bar window.
You can enter or type windows form.
Once you have typed in Windows form in the search bar on the languages option click on the dropdown
select C sharp in the all platforms menu click on the dropdown and select windows select the first option.
Make sure it is highlighted and click on Next in the config for your new project window.
I'm going to change the default project name from Windows Forms app 1.
Just going to call it greetings but you can call it whatever name you like.
Once you've given your project a name click on the create button.
Once you have selected your C sharp project template and the name for the file features G2 then opens
up a form for you.
A form is a Windows user interface so we're going to create a simple Hello World application by adding
controls to the form and they will run the application let us begin by adding a button to the form.
So to begin on the side here there is the tool box.
Just click on the tool box.
If you do not see the tool box on the side menu you can also access it by going to the view option and
then within the view option you can click on tool box to add a button to the form inside the tool box
menu.
Expand the all windows form and they will look for a button widget.
This is a button widget and then just drag that and drop it on the form.
Any control or widget that you add into the form area also has a properties area that you can use to
modify its properties.
We can see in this area here.
This is the properties for the button control I've just added.
So by default it gives it a name of putting one so first and I want to do is to change the name of a
button so inside the properties area I have to look for the text which is here.
So I'm going to change the text from button 1 to something I'll have change the text to click me by
changing the text inside the properties area.
You can see in the form the name has also changed to reflect that to change the properties of any control
or widget.
You must have it selected so you can see inside the form I've got the button controls selected so the
properties are reflected in what I've selected.
Also within the properties for this button I want to change the name in the design section so this is
the design section of the properties for those buttons.
I'm going to change the name from button 1 to something else.
I've changed the name to BTR and click me and then I'll press enter on my keyboard.
The next thing I want to do is add a label to the form so I'm just going to go to the tool box again
and inside the menu I'm going to look for the label.
You can see I've got a label here.
I'm just going to drag that and drop it on the form while I've got the label control selected.
You can see the property page comes up with the name label one so in the design area of the properties
window for this label control.
I want to change the name from label 1.
I've changed the name in the design area here to LP l Greetings.
I'm just going to press enter and that will change the name.
You can see the name as reflected on the top here.
The way the application is going to work is that when we click on the button just got the text.
Click me it will display a text in the label so to achieve that we're going to add some code to the
form.
So to do that I'm going to double click on this button that's called Click me.
I'm going to add a line of code on line number twenty two.
I've added a line of code on line number twenty to help me.
L greetings.
Basically is referencing the label control that is on the phone.
The text basically means I want to display the text in quotes which is hello world one that displayed
in the label.
So when we run the application and with click on the button it would display the text hello world inside
the label.
Notice that the yellow strip of line here basically indicates that I've made some changes to my code.
Both have not saved it so to save it I'm just going to click on this save all and that should go green.
You can see is concrete.
The application is basically complete it is now time to run the application so to run the application
just click on the start button here and we can see the application is being built in the output window.
We then get a form that opens up outside Visual Studio.
So this form now is outside Visual Studio.
So this is the application is the interface for the application.
So the way the application work is very simple.
I click on the button that says Click me it would display a text that says hello world inside this label
Code label one so I'll click click me you can see the text.
Hello world is being displayed to exit the application.
I just click on The X here and now exit out of the form and then I can close the output window just
by clicking on the X and then close visual studio so I'll go file and exit.