Home   Email   
 

Home

VB.NET 2005/2.0

C#.NET 2005/2.0

ASP.NET 2005/2.0

SharePoint Course

Microsoft BizTalk Server

Microsoft CRM

First Project

Second Project

Download Tools




Visual Basic 2005 Programming

Visual Studio .NET Getting Started

By Hafeez Mohammed

When Visual Studio 2005 is started, the window shown below, to permit you to configure your custom profile. Unlike previous versions of .NET, where you selected a set of preferences that you would then use for all of your development, Visual Studio 2005 allows you to select either a language-specific or task-specific profile.

Configuration of the settings is managed through the "Import and Export Settings . . ." menu option of the Tools menu. This menu option opens a simple wizard, which first saves your current settings and then allows you to select an alternate set of settings.

The development environment does look a little different from those old days of Visual Basic 6.

One of the changes in Visual Studio 2005 is that once you have selected a default environment setting, you are presented with a setting-specific project view.

To the left of the screen, you have the Toolbox, full of controls. You'll notice a few favourites in there – the Label control, the TextBox, the PictureBox. And a few have been renamed – such as the Radio Button (formerly Option Button), GroupBox (old Frame) and of course, Button (of Command Button fame).

You'll also spot a whole load of new controls there. We'll look at these in more detail later – but they're actually not as scary as they first appear! ;)

To the right of your screen, you have the Properties window, which doubles up as a Help facility. Plus, just above that you'll find what was previously the 'Project Explorer'. This keeps a track of all the files and references within your app.

And finally, in the centre of your screen you'll find Form1, just like old VB6.

Here we will learn about the Visual Studio.NET integrated development environment (IDE), which enables you to develop applications based on the .NET framework.
The Visual Studio.NET IDE is common to all of the .NET languages, and this means you can use the same set of tools and windows across languages.

An IDE is a way of bringing together a suite of tools that makes developing software a lot easier. Fire up Visual Studio 2005 and see what you've got.
If you used the default installation, go to your Windows Start menu and then Programs (All Programs on Windows XP and Windows Server 2003) ® Microsoft Visual Studio 2005 ® Microsoft Visual Studio 2005.
A splash screen will briefly appear, and then you should find yourself presented with the Choose Default Environment Settings dialog box.
Select the Visual Basic Development Settings option and then click Start Visual Studio.
The Microsoft Development Environment will appear

Windows and Tools in the Visual Studio .NET IDE

The following sections describe the features and functions of the following windows and tools:

  • The menu bar

  • Toolbars

  • The Start page

  • Solution Explorer

  • Class View

  • Dynamic Help

  • The Toolbox

  • Server Explorer

The Menu

By now, you may be a bit eager to start writing some code. But first, begin your exploration of the IDE by looking at the toolbar and menu, which, as you will learn are not really all that different from the toolbars and menus you have seen in other Microsoft software such as Word, Excel, and PowerPoint.

Visual Studio 2005's menu is dynamic, meaning that items will be added or removed depending on what you are trying to do. While you are looking at the blank IDE, the menu bar will consist only of the File, Edit, View, Data, Tools, Window, Community, and Help menus. When you start working on a project, however, the full Visual Studio 2005 menu appears

  • File: It seems every Windows program has a File menu. It has become the standard where you should find, if nothing else, a way to exit the application. In this case, you can also find ways of opening and closing single files and whole projects.

  • Edit: The Edit menu provides access to the items you would expect: Undo, Redo, Cut, Copy, Paste, and Delete.

  • View: The View menu provides quick access to the windows that exist in the IDE, such as the Solution Explorer, Properties window, Output window, Toolbox, and so on.

  • Project: The Project menu allows you to add various files to your application such as forms and classes.

  • Build: The Build menu becomes important when you have completed your application and want to run it without the use of the Visual Basic 2005 environment (perhaps running it directly from your Windows Start menu, as you would any other application such as Word or Access).

  • Debug: The Debug menu allows you to start and stop running your application within the Visual Basic 2005 IDE. It also gives you access to the Visual Studio 2005 debugger. The debugger allows you to step through your code while it is running to see how it is behaving.

  • Data: The Data menu helps you to use information that comes from a database. It appears only when you are working with the visual part of your application (the [Design] tab will be the active one in the main window), not when you are writing code.

  • Format: The Format menu also appears only when you are working with the visual part of your application. Items on the Format menu allow you to manipulate how the controls you create will appear on your forms.

  • Tools: The Tools menu has commands to configure the Visual Studio 2005 IDE, as well as links to other external tools that may have been installed.

  • Window: The Window menu has become standard for any application that allows more than one window to be open at a time, such as Word or Excel. The commands on this menu allow you to switch between the windows in the IDE.

  • Community: The Community menu provides access to developer resources, where you can ask questions, search for code snippets, and send product feedback.

  • Help: The Help menu provides access to the Visual Studio 2005 documentation. There are many different ways to access this information (for example, via the help contents, an index, or a search). The Help menu also has options that connect to the Microsoft Web site to obtain updates or report problems.

The Toolbars

Many toolbars are available within the IDE, including Formatting, Image Editor, and Text Editor, which you can add to and remove from the IDE via the View ® Toolbars menu option. Each one provides quick access to often-used commands, preventing you from having to navigate through a series of menu options. For example, the leftmost icon (New Project) on the default toolbar (called the Standard tool- bar) is available from the menu by navigating to File ® New ® Project.

So, let's do something!

  • Add a Button to Form1, just as you would in VB6
  • Double-click on the Button

Wow! What's all that code?

You've just double-clicked on the Button and a whole load of pre-written code has popped up. Where? Who? Why? Well, it's essentially code that tells the form how to build itself – but ignore it for now.

Your cursor should be flashing between:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        
End Sub

Now, this is similar to our old Command1_Click() sub, though a perhaps a little more complex.

Type in the following code:

MessageBox.Show("Hello World!", "My First App")

Whilst the MsgBox statement still exists, MessageBox.Show is the way to display.

  • Press F5 to test your code

After a little wait your form should popup.

  • Click the Button to display your Message Box

Your form should look something like this:

And that's it! Hurrah and congratulations on creating your first VB.NET application!

Back to VB.NET Course Lab


 


ASP at ITM

Home | VB.NET Course]



                        Linking   Advertising

© 1998, 2003 Developed and Powered by ITM Consulting Group, Inc.