Home
Username:
Password:
Introduction to Microsoft Visual Studio 2008 Tutorials

Getting Started With Visual Studio 2008 / Hello World Again

Subtitles of the Movie

Kind of a standard out there for any kind of programming environment is the classic Hello World program, OK, so I'm going to do a quick Hello World program for you and show you what it looks like to build a program and how it behaves in the Visual Studio environment, OK? So, first step on building a program, obviously, we need to open Visual Studio so we'll click on Start. And notice, since I've already opened it previously that it may show up on your Start Menu kind of in this panned area right here. You can click on it there or you may have to go look for it in your Menu and you'll notice it's right here, it's all Open Visual Studio. Now, depending on humidity and a bunch of other things I'll actually show you how to set this later, you may or may not see this Start Page, OK? If you do see the Start Page, notice I can create a project right here and if I click this it will ask me what kind of project to I want to create? Now in a different video we'll take a look at some of the differences here. But let's say that you don't get this Start Page when you start yours up and I'm going to close it. Yours might very well open up this way. If it does, there are a couple of things I can do. I can do File, New Project, and that will take me back to the same place. There's also a Toolbar right here for New Project and there's a drop-down, and I can do a New Project or a New website. So I can do New Project that way. They all take me to the same place. A lot of things on the Project Box and Types that we'll get into later. For now we're going to say we'll just take the name, Windows Application 3, and I'll tell you what, I'll actually change that to Hello World, OK, and then, notice it is a Windows Forms Application and I will say OK. Now, what this thing's going to do is go ahead and build a Windows Forms Environment for me. Now notice what this has done. It's got all the controls that are available for a Windows Form Project. It has my Solution Explorer over here, notice I've got my first Form up here, and then I have Properties for this form, OK? And so notice that right now it's Form 1 and when I clicked on it, notice it highlighted for all the Properties of the Form, OK, and so for example, if I want to change what's showing on that Form I can go down to the Text Property and it'll take me a minute to look simply because I'm looking for it. I can give my Form a name right here, and we'll just leave it as Form 1 for now, and if I scroll up you'll notice Text right here, I'll just type: Hello World, and then when I click off of that you'll notice that it changed it to Hello World right here, so that's the actual Text Property of my Form. So, in programming Visual Studio how do we give it functionality? Well, the first thing we need to do is put some sort of Button or something out here and so what I'm going to do is go grab a Button; notice I'm going to left-click on it, drag the Button onto the Form and simply let it go and it puts the Button there. Now, I can, anywhere I get the four arrows I can click and I can move the Button around and obviously I can grab the handles and make my Button a different size, right? I'll show you another cool feature about this. If I drag another Button on you'll notice that it puts the little blue lines, and any time I move it, it will now help me arrange these Buttons so that they look you know, attractive and they're in the proper place, and so forth, and they line up. You'll notice that it lined up the right side and if I drag it this way it'll line up the left side. Now to get rid of a Button all I have to do is highlight the Button and hit Delete. OK, so this is going to be a very simple somewhat useless application called Hello World, OK? So to write the code for this, when this program runs I would like the user to click on Button1 and have it say: Hello World, and so let's change the name of this Button or the text on this Button, not the name, we'll change the text, and notice when I clicked on the Button it says Button1 Properties, we'll change the text on it to say Click, and notice, it now says Click. Now I'm going to double-click on the Button and you're going to notice this brings up the Code Behind page, and you'll notice if I scroll across you can see it's already written some code for me and this is an Event Handler and so when anybody clicks on that Button this Event is going to be fired, or going to be executed, and what are we going to do? Well, I'm going to say MsgBox, and I will just say Hello World, and then when I click anywhere else it completes it for me, OK? Pretty straightforward, right? So, there's my Code Behind; notice Form1, VB, then here's my Design Page, and notice how this is tabbed for me, and I can move back and forth between them. And if I move this, notice it didn't change my code but it did move that and it stays where I put it, OK? So now, let's run our simple useless program. So I'm going to click on the Start Debugging Toolbar, so what's going to happen is it's going to run this program for me, and here's my program running. Notice I can move it around and if I click on this it brings up a message box that says Hello World. Pretty cool, huh? Very simple application, and what we're going to talk about as we go through the video are the various aspects of the screen that it used to create this. Now this won't be a programming class per se; you will see a little bit of code but we're going to talk about how you can use Visual Studio to build these applications and how these various pieces and parts and toolbars, and some of the most commonly used Toolbar Buttons work. We're going to talk about Server Explorer and so forth, and a big question is, well, wait a minute, where is the program that I just built? And I'll show you that in a different video. But what you've just seen here is a very simple way to write a very simple program and you can play with it and now we say OK, we like that, we tested it, how do I make it get ready to release it? Notice, I can build Hello World. Come up here to Build, click Build Hello World and it just compiled my program and it created an executable file in a different video. I'll show you how to go out there and grab that and get a hold of the application that you just created. So, there's a very simple example of creating an Application in Visual Studio 2008.

Tutorial Information

Course: Introduction to Microsoft Visual Studio 2008
Author: Mark Long
SKU: 34008
ISBN: 1-935320-54-8
Release Date: 2009-06-26
Duration: 7 hrs / 72 lessons
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available