1 00:00:00,860 --> 00:00:03,540 Hello and welcome to this video. 2 00:00:03,590 --> 00:00:14,020 In this video I'll be creating a very basic Windows form application using C sharp and Visual Studio 3 00:00:15,600 --> 00:00:19,230 to begin let's open of Visual Studio. 4 00:00:19,230 --> 00:00:30,540 So click on my start menu and then locate the features judicial icon which is this icon here features 5 00:00:30,600 --> 00:00:31,840 to 2019. 6 00:00:31,840 --> 00:00:37,990 I'm gonna click on it from the Visual Studio start screen. 7 00:00:37,990 --> 00:00:48,170 I'm going to click on the link to create a new project inside the search bar window. 8 00:00:48,340 --> 00:00:53,480 You can enter or type windows form. 9 00:00:53,500 --> 00:01:03,030 Once you have typed in Windows form in the search bar on the languages option click on the dropdown 10 00:01:03,510 --> 00:01:16,970 select C sharp in the all platforms menu click on the dropdown and select windows select the first option. 11 00:01:16,980 --> 00:01:26,230 Make sure it is highlighted and click on Next in the config for your new project window. 12 00:01:26,250 --> 00:01:33,740 I'm going to change the default project name from Windows Forms app 1. 13 00:01:33,930 --> 00:01:38,550 Just going to call it greetings but you can call it whatever name you like. 14 00:01:38,580 --> 00:01:44,640 Once you've given your project a name click on the create button. 15 00:01:44,790 --> 00:01:53,490 Once you have selected your C sharp project template and the name for the file features G2 then opens 16 00:01:53,490 --> 00:01:55,950 up a form for you. 17 00:01:56,550 --> 00:02:07,410 A form is a Windows user interface so we're going to create a simple Hello World application by adding 18 00:02:07,410 --> 00:02:19,040 controls to the form and they will run the application let us begin by adding a button to the form. 19 00:02:19,400 --> 00:02:24,110 So to begin on the side here there is the tool box. 20 00:02:24,140 --> 00:02:25,550 Just click on the tool box. 21 00:02:26,910 --> 00:02:36,060 If you do not see the tool box on the side menu you can also access it by going to the view option and 22 00:02:36,060 --> 00:02:45,230 then within the view option you can click on tool box to add a button to the form inside the tool box 23 00:02:45,230 --> 00:02:45,770 menu. 24 00:02:45,770 --> 00:02:53,830 Expand the all windows form and they will look for a button widget. 25 00:02:53,840 --> 00:02:59,690 This is a button widget and then just drag that and drop it on the form. 26 00:02:59,810 --> 00:03:11,270 Any control or widget that you add into the form area also has a properties area that you can use to 27 00:03:11,270 --> 00:03:12,750 modify its properties. 28 00:03:12,750 --> 00:03:14,330 We can see in this area here. 29 00:03:14,570 --> 00:03:19,640 This is the properties for the button control I've just added. 30 00:03:19,640 --> 00:03:27,800 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 31 00:03:27,800 --> 00:03:33,860 button so inside the properties area I have to look for the text which is here. 32 00:03:33,860 --> 00:03:43,730 So I'm going to change the text from button 1 to something I'll have change the text to click me by 33 00:03:43,730 --> 00:03:47,230 changing the text inside the properties area. 34 00:03:47,360 --> 00:03:57,690 You can see in the form the name has also changed to reflect that to change the properties of any control 35 00:03:57,690 --> 00:03:58,910 or widget. 36 00:03:58,910 --> 00:04:06,440 You must have it selected so you can see inside the form I've got the button controls selected so the 37 00:04:06,440 --> 00:04:10,440 properties are reflected in what I've selected. 38 00:04:10,550 --> 00:04:20,180 Also within the properties for this button I want to change the name in the design section so this is 39 00:04:20,180 --> 00:04:24,170 the design section of the properties for those buttons. 40 00:04:24,170 --> 00:04:30,200 I'm going to change the name from button 1 to something else. 41 00:04:30,200 --> 00:04:37,440 I've changed the name to BTR and click me and then I'll press enter on my keyboard. 42 00:04:37,910 --> 00:04:45,560 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 43 00:04:46,250 --> 00:04:53,010 and inside the menu I'm going to look for the label. 44 00:04:53,030 --> 00:04:54,790 You can see I've got a label here. 45 00:04:54,890 --> 00:05:03,890 I'm just going to drag that and drop it on the form while I've got the label control selected. 46 00:05:04,040 --> 00:05:13,340 You can see the property page comes up with the name label one so in the design area of the properties 47 00:05:13,340 --> 00:05:16,600 window for this label control. 48 00:05:16,700 --> 00:05:21,550 I want to change the name from label 1. 49 00:05:21,680 --> 00:05:28,190 I've changed the name in the design area here to LP l Greetings. 50 00:05:28,460 --> 00:05:32,960 I'm just going to press enter and that will change the name. 51 00:05:32,960 --> 00:05:36,720 You can see the name as reflected on the top here. 52 00:05:36,950 --> 00:05:45,740 The way the application is going to work is that when we click on the button just got the text. 53 00:05:45,740 --> 00:05:58,310 Click me it will display a text in the label so to achieve that we're going to add some code to the 54 00:05:58,310 --> 00:05:59,210 form. 55 00:05:59,510 --> 00:06:07,670 So to do that I'm going to double click on this button that's called Click me. 56 00:06:07,670 --> 00:06:15,170 I'm going to add a line of code on line number twenty two. 57 00:06:15,290 --> 00:06:20,720 I've added a line of code on line number twenty to help me. 58 00:06:20,730 --> 00:06:21,680 L greetings. 59 00:06:21,680 --> 00:06:28,330 Basically is referencing the label control that is on the phone. 60 00:06:28,520 --> 00:06:39,590 The text basically means I want to display the text in quotes which is hello world one that displayed 61 00:06:39,770 --> 00:06:40,890 in the label. 62 00:06:41,030 --> 00:06:49,640 So when we run the application and with click on the button it would display the text hello world inside 63 00:06:49,880 --> 00:06:51,380 the label. 64 00:06:51,380 --> 00:07:00,110 Notice that the yellow strip of line here basically indicates that I've made some changes to my code. 65 00:07:00,230 --> 00:07:07,640 Both have not saved it so to save it I'm just going to click on this save all and that should go green. 66 00:07:07,640 --> 00:07:09,300 You can see is concrete. 67 00:07:09,350 --> 00:07:17,960 The application is basically complete it is now time to run the application so to run the application 68 00:07:18,020 --> 00:07:27,190 just click on the start button here and we can see the application is being built in the output window. 69 00:07:27,260 --> 00:07:32,660 We then get a form that opens up outside Visual Studio. 70 00:07:32,660 --> 00:07:35,410 So this form now is outside Visual Studio. 71 00:07:35,420 --> 00:07:40,320 So this is the application is the interface for the application. 72 00:07:40,370 --> 00:07:43,090 So the way the application work is very simple. 73 00:07:43,230 --> 00:07:52,160 I click on the button that says Click me it would display a text that says hello world inside this label 74 00:07:52,160 --> 00:07:57,490 Code label one so I'll click click me you can see the text. 75 00:07:57,530 --> 00:08:03,070 Hello world is being displayed to exit the application. 76 00:08:03,110 --> 00:08:11,900 I just click on The X here and now exit out of the form and then I can close the output window just 77 00:08:11,900 --> 00:08:21,200 by clicking on the X and then close visual studio so I'll go file and exit.