Hey everybody, this is Brian and today we start our 20th C-Sharp tutorial, effectively what I call the good stuff. It's great to do a console application but sometimes you need a little bit more like a Windows application. So that's what we're going to dive into today and we're going to spend quite a bit of time on Windows apps and then we're potentially going to do services and then web pages. I know a lot of you want to do web apps. So we have our simple Windows application. You see this is Form 1 and there's this little window and when you click the close button nothing happens. Why is that? Well this is actually your window template. You see how you can kind of scale this around and do whatever you want. But none of the actual buttons and stuff work. Why is that? Well it's because this is a canvas that you can drag and drop tools onto. Now if you click the solutions explorer you'll see that you can pin that up there. You've got Form 1 and that's what this is, is Form 1. If you expand that out you see there is a Form 1.designer and a Form 1.res. The designer, if you click that, this is the actual source code behind that form. You can see there's a lot of stuff in here that's already pre-generated for you. For example initialized component, etc. Microsoft has done a fairly good job of commenting what this stuff does. General rule of thumb don't modify this. Then there's this ResX. What is that? This is a resource file. Something you may have covered in other languages. Basically a resource file allows you to put resources, images, strings, things of that nature in a file. Let's close that. Let's go Tools over here and let's pin that up. Now you see you have this huge, huge, huge assortment of controls. We're going to go over a lot of these. I have to apologize if you hear some thumping noise. My cat is jumping around my desk like a lunatic. First thing we're going to do is put a button on here. You just click drag and drop. You notice how it gets these little handles and you can resize the button however you see fit. Let's just throw that in the center here. You know how it's off center? Well you have these positionals. You can say we want this center that way. See if I can get this right. Center horizontally. There we go. Center vertically. There we are. It makes it easier to center things. Now to run you just click this little Sturdy bugging or you can press F5 on the keyboard. Let me move the window over here. You see there's our beautiful window with our button that does absolutely nothing. So what we're going to do is we're going to make this button do something. I realize this is a very simple tutorial but gooey programming may be new to some of you out there. If it's not bear with me we're going to ramp up these tutorials fairly quickly. Alright so select your button. You can tell it's selected because you've got these little handles around it. Just double click it. You notice how it dumps you directly into the code view. Let's expand that. So we're in button one click. This is an event. Windows form programming is event driven meaning this is called when the button is click. That's an event handler. Notice how there's an object sender everything in dot net says object. So we're just saying whatever the sender was. An event args. What are event args? Well event args or short for event arguments. It's just an argument sent with the event. And you can actually expand that and create your own event args. I actually do that quite a bit my own programming. But like I said this is a beginner's tutorial. So we're going to keep it very simple. All you need to understand at this point is when the user clicks that button this event is called. And we can even say this is called when the button is clicked. My cat is looking at me like I have just lost my mind. Go wakey. And what we want to do is type message box dot show. And we're just going to say hello world. The obligatory hello world application here. And let's run this. Show our window here. Click it. Hello world. So that is our very first Windows form application. Not a lot to it mind you. One thing you should note in the solution explorer here. Let me see if I can actually find it view. Hmm. Other windows properties. What does here we go. Everything has properties and this is the properties window. So when you click your button you see it has a bunch of properties. And when you click your form has a bunch of properties. See like the name even so we can change the title here. See text form one. Let's just call this my app. Notice how the title bar over here changed. Button one the text let's just say click me. Notice how it changed. See this little lightning bolt here. That's the events. And you can as you can see the click event is linked to button one click. And if you just double click that takes you right to it. Pretty simple pretty easy to understand. Notice how the properties for the code view are not displayed because well code doesn't have a property. But the designer view does and you can switch from events to properties just by clicking the buttons. You can group them by category. And you can sort alphabetical. I understand that because this window is so small it's probably a little cluttered. Yours is probably much better on your screen. So that is it. Our very first gooey application in C sharp. And you can kind of stretch us out modify it do whatever you want. Well this is Brian. Thank you for watching. I hope you found this educational and entertaining.