1. Home
  2. Computing & Technology
  3. Visual Basic

Visual Basic .NET for Beginners
Clicking with Visual Studio

By Dan Mabbutt, About.com

Jul 4 2009

Instructions for using software often just say, "click the mouse" but that too can be confusing. Left-clicking gives you a completely different result than right-clicking; and double-clicking is usually quite different than single-clicking.

There is a logic to left-clicking versus right-clicking (and this is true of nearly all Windows software). Left-clicking always "does" something. You click a button to do whatever the button does. You click a down arrow to move something down or open a drop-down box. The point is, something happens as a result. But right-clicking usually simply opens a "context menu" that gives you more choices. The choices you get depend on the "context" where you right-click. If you right-click inside a form, a different menu of choices will be displayed than if you click in the Properties window ... and the same for all the other windows. So if you want to do something with a window on the screen, but you don't see that choice available anywhere, try right-clicking. What you want to do may be in the context menu.

I just wrote that left-clicking "does something". When you single-click the left button, you usually "select" whatever the mouse pointer is over. When you double-click things, you may be asking Visual Studio to do something more involved. In the case of components in the design window, you will open the code window and create the default event code for that component. So avoid double-clicking unless that's what you want to do.

The Visual Studio Project Types

When you select "New Project", you are given a default selection of five different types of projects that you can create with Visual Basic Express 2008:

  1. Windows Forms Application
  2. Class Library
  3. WPF Application
  4. WPF Browser Application
  5. Console Application

There's also a "Search Online Templates" icon, but that has never resulted in anything in my experience. Sometimes, Microsoft creates blind alleys.

This tutorial primarily uses Windows Forms and Lesson 1 described them. Keep reading and you'll know a lot more about them.

WPF is "Windows Presentation Framework" and it's a completely new way to "present" systems to the people who use them. Microsoft uses the word "presentation" because they have opened it up to much more than just images on screens. Microsoft defines it this way: "Windows Presentation Foundation (WPF) provides developers with a unified programming model for building rich Windows smart client user experiences that incorporate UI, media, and documents."

It's a huge and very new technology and most people expect WPF to replace Windows Forms at some point. But it might take quite a few years. You can find articles explaining WPF here at About Visual Basic. Just use our integrated search facility to search for WPF at this site.

A Class Library is a collection of software "objects" that can be used to do things inside a program. The .NET Framework itself is just a mammoth collection of class libraries. You can code your own as you advance in your skill as a programmer.

A Console Application is a program that does not have a GUI. (Both Windows Forms and WPF create a GUI. The the first part of this lesson for an explanation of GUI.) To use a Console Application, you have to use the Commmand Prompt "DOS" emulation built into Windows. People sometimes use them to create "lightweight" (low memory and CPU use) applications that can run even when Windows can't. For example, a lot of communications (TCPIP and FTP) and other system utility programs are written as Console Applications.

Everything is an object

Programming today is almost exclusively "object oriented" (OOP). A very fast definition of a software object is software that includes data (properties) and can do things (methods). A button is an object because it includes data like the size, name, and text on the button and when you click it, a program starts running. You can study objects in depth in books written about the concept, but this simple understanding will do just fine to get started. In general, everything in .NET programming is an object. VB.NET includes a tool that is used exclusively to find information about objects called the "Object Browser". It's usually on the Visual Studio toolbar but you can also find it under the View menu.

The Object browser will give you information about all of the objects in the .NET Framework. All of the methods (what an object can do), properties (data in an object) as well as the events (subroutines that can be started by changes that the object detects) are listed there in one place. You can use this tool to learn about unfamiliar objects and look for ways that objects are used. Just for practice, you might want to search for MonthCalendar, the component we learned about in the previous lesson.

Properties and the Design Window

In Lesson 1, we changed all of the Properties of the control objects that we added to our project before doing anything else. That's a good habit to learn. Some of the properties of objects can be difficult to change after a lot of code has been written, so getting their values correct to start with is important. The Properties window only shows the properties of objects when the Design window (not the Code window) is selected because you can't select a specific object in the Code window and Visual Studio can't determine what control object to display properties for.

The Name is an example of an object property that should always be changed as soon as the object is added. The Visual Studio Property window sorts Name to the top of the Properties window by adding parenthesis around it because the character "(" sorts before alpha characters. You should change the Text property immediately as well.

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Learn VS.NET
  6. Beginning Tutorial to Learn Visual Basic .NET - 2

©2009 About.com, a part of The New York Times Company.

All rights reserved.