Visual Basic – The IDE

Visual Basic – The IDE

IDE is an abbreviation for integrated development environment. An IDE is a computer program which helps you write computer programs. It usually includes an editor to let you write code, various programs which help you run the code, and other programs to help you find problems in the code you wrote. In order to write Visual Basic code you need to know how the IDE works.

Index

 Creating a Project

You don’t create a Visual Basic program. You create a Visual Basic project. We call it a project because it consists of multiple files and, possibly, multiple programs.

To create a Project

Enter Visual Studio Express 2013 (VS Express 2013) vbp1

Select “New Project” The new project window will open. Make sure that “Windows Form Application” is highlighted. You will need to change the Name and the location of the project.

vbp2

 

Name: – an abbreviated name which includes your name and the project name is fine. For example, my last name is Gulino and my first project is Hello World. My project would be named HelloWorldBGulino.

Location: – the location defaults to the projects folder on the computer you are working on.

If you have a flash drive, you want your project to be located on your flash drive. The browse button to the left of the location box is helpful in finding the correct folder. A typical location for the flash drive would be “F:\vb\”

If you aren’t using a flash drive, and you are going to save your program to, for example, a dropbox account, you can change the location of the project to something easy to get to. The Windows desktop is very accessible.

Setting up the IDE

vbp3

 

Click on the Circled word “Toolbox”. The VB toolbox will open on the side of the screen.

vbp4

Click on the circled icon of a thumbtack. The design window should then be positioned so you can work. Also, you may have to click on the “Common Controls” chevron displayed above.

Editing Your Program

When you run your program you may get error messages. Error messages refer to the line in the code which generated the error. Show line numbers in your code by changing the editor display options to display line numbers.

Choose the Debug->Options and Settings window and this will appear:

vb9

Note that you will have to click on the chevron next to the text editor in order for the detail to display. Then click on the chevron next to All Languages. Finally check the Line Numbers check box. File all this and you will get line numbers on your computer code which should make it easier to track error messages.

Running your Program

You run your program by pressing the F5 key or by accessing the Debug ->Start Debugging menu selection. Make sure you exit the running program if you want to do more work on the code.

Saving your work so that you can start up again where you left off.

Running the program automatically saves your work. You can also save your work by accessing the File->Save All menu selection. Don’t use any other Save selections on this menu.

Starting up Again

You can continue programming again by double clicking on the *.sln file in File Explorer. This file is located in the project’s folder. The programming environment may not look the same after opening the project. You can recover your programming environment by doing the following:

  1.  Press F5 to run the program. Confirm that you are accessing your program. Then exit.
  2. Reset the environment by accessing Window->Reset Windows Layout.
  3. If you can’t see your form in the design window in the middle of the screen, do the following:
    1. Recover the design window by clicking on the form name in the Solution Explorer pane on the upper right of the screen. If the solution explorer pane is not visible, recover it by entering  ctrl-W-S or View->Solution Explorer.
    2. The form name is typically Form1.vb. Double click on the form name to recover the form.

After you have done this, you can exit shut the Solution Explorer pane by pressing the X in right hand corner of the pane.

Occasionally you may be able to load your project, run the code, yet be unable to view your source code or access design mode. If this is the case, restarting the computer may fix the problem.

Finding Your Project

If you are working on your project, but you have no idea where the computer is storing it, here’s some steps you can follow in order to find it.

  1. Open the solution explorer window. This should open in the upper right hand corner when you go to standard settings.
  2. Right click on the “Solution” line which shows the name of your project. A context menu will appear.
  3. Choose “Open Folder in File Explorer” from the context menu.
  4. Your project should open up in file explorer and display the path for the project at the top.

bg1

Visual Basic Project File Structure

When you create a Visual Basic Project named, for example, “GulHello”, the project has the following file structure on your system.

vbp6

This is the topmost folder. If you are going to copy the project, this folder and everything contained in it must be copied. Let’s click on the folder to see what’s inside:

vbp7

Notice we have another folder and two files. The folder, GulHello has the same name as the folder above it in the file hierarchy. Yes, this is confusing and the source of many copying errors. Don’t copy from here, copy from one level above here. The file GulHello.sln is significant because you can double click on it and run the Visual Basic IDE for this project. The suffix sln stands for “solution”, by the way. If we double click on this GulHello folder, we see this:

vbp8

These are all the files and folders needed to support a simple Visual Basic program.

Leave a Reply

Your email address will not be published.