Introduction to Visual Studio.Net


Getting Started

Sometimes the best way to get started is to jump right in, so here we go. On your computer, either
  1. double click the Visual Studio.Net 2010 desktop icon, or

  2. click Start Programs Microsoft Visual Studio 2010 Microsoft Visual Studio 2010 from the Start menu.

Upon completing either of these, Visual Studio.Net 2010 should launch, and you should see something like:



Take a minute and examine this screen capture. This is the Visual Studio Start Page (notice the Start Page tab), however, we are not into the Visual Basic environment yet. Notice the Menu Bar as well as the New Project and Open Project selectors pointed to by the green arrows. Either of these will enable you to determine which .Net project type to open.


From the Menu Bar, select the Tools menu, Import and Export Settings, Reset All Settings, No, then select General Development Settings. This should help your User Interface (UI) more closely resembling the screen Images in this section.

Next, on the Menu Bar, select File New Project menu or select New Project from the Start page and you should see a window something like:


This is the New Project form (see the title bar). This is where selections for the type of New Project will be made. There are several important selections to be made on this form:
  1. Project Templates - this is where the .Net language of choice is selected. For us, this should always be Visual Basic and Windows.

  2. Project Applications - this is where we can select from the standard set of predefined applications. For us, this should always be a Console Application or a Windows Forms Application (what's the difference?).

  3. Name - the name to be given to the VB.Net application. The name should always be indicative of what the application does, e.g. TaxCalculator (not WindowsApplication1).

  4. Location - the file system location where the application folder and files will reside


I suggest un-checking the "Create directory for solution" checkbox. Checking this will only add another Folder layer in the file system hierarchy. By unchecking this, the main Folder as well as most of the files will get the name of your application and reside in the location specified. Once unchecked, the "Solution Name" textbox will be greyed out.


Visual Basic.Net Development Environment

Once you click the OK button in the New Project form, you will launch the Visual Basic.Net Integrated Development Environment (henceforth referred to as the IDE) window. It is in this window that most, if not all development will be coordinated and performed. The startup IDE will look something like the following:


If the IDE you launch does not have a specific window open which is present in the figure above, you can simply add it by using the View menu on the menu bar. You can also close extraneous windows by clicking on the close icon in the upper right corner of the window.

There are four windows on which to focus in this diagram:

  1. Solution Explorer - this window contains a list of all open projects and files/items associated with the current solution.

  2. Form designer - this window is where all controls for a given solution will be placed and manipulated. A windows application may have one, two or many windows forms associated with it. Note a console application will have no form designer window, nor toolbox, since a console application contains no forms.

  3. Toolbox - this window is where all VB controls will be retrieved from. In actuality, you can consider the items in the toolbox as class containers. Retrieving a control from the toolbox is analogous to instantiating an object from that class. Thus clicking on the button item (class) in the toolbox will give you a button object. You can either double click on the control you wish to add to the form, or you can drag and drop your control.

  4. Properties - this window is where property values are set for a given control.

There are many more windows in the IDE, but these are the ones use most frequently used and helpful to keep open during program development.


Solution Components

A solution is the main organizational unit of Visual Basic.Net. A solution contains numerous files in VB.Net, including, but not limited to: multiple folders, files with the extensions of .sln, .suo, .vb and a plethora of others. While all of these files and file types are important, I do not want to detail what each file and file type is. Rather, I want to focus on the bigger picture of the solution as a whole entitiy.

To view a solution in another context, we can picture something we already understand, such as a filing cabinet. Using the analogy of a file cabinet, each Visual Basic solution can be viewed as an individual drawer within the cabinet; each project can be viewed as a file folder within a drawer; and the individual solutions files can be viewed as pages (i.e. documents) within the file folder.

Having stated the above, the most important thing to note is you cannot lose any of the files from the solution. Just as losing pages from a file folder would make that folder incomplete, losing any of the files from a solution will make that solution incomplete, and leave it non-functional!

To be safe, always move the solution as an entire Windows folder, never move the individual files.


Once you have successfully created your solution and have exited the .Net environment, you can re-open that solution by double-clicking on the .sln file. Windows file associaion will start up .Net and open the solution.


More on Controls and Properties

Since we've recently discussed objects and object-oriented concepts, let's look a little closer at VB controls and corresponding properties. As mentioned above, controls are retrieved from the toolbox. But there's more to this: controls in .Net are actually objects.

As we've learned, objects are instantiated from classes. So, where does a button object come from, you ask? A button class! When you retrieve a control from the toolbox, you are actually instantiating an object from the class of that control.

As we've also learned, objects are defined by the attributes that describe them. In the .Net world, these are referred to as properties. Thus, a button object is defined by its properties and a textbox is defined by its properties. Where do you view or set an objects properties? In the properties window described above, when that object is selected. Thus selecting a control object in the form window will populate the properites window with the specific properties for that control.

Each control is given default properties when it is created (instantiated). The specific default properties depend upon the specific control, however there are some consistencies between controls. For example, most controls have a color, font, size, location, and other similar properties. However, there are two important properties that all controls share, specifically the:

The Name property is the name of the control object itself. This value is what the VB developer uses to refer to the object within the programming environment. The user will never see this property value.

The Text property is the text (for lack of a better word) or label or caption that is displayed for the user. For example, the 9 character is the Text property of the nine button on the Windows calculator (see below).

Controls and their associated properties will be examined in much greater detail when we discuss Windows based .Net applications.



Next Section: Program Elements Table of Contents


©2007, Mark A. Thomas. All Rights Reserved.