Using the 3D Connexion SDK/A Quick introduction to Visual Basic

A Quick introduction to programming and Visual Basic

edit

There are many excellent references for learning to program in Visual Basic. Sites such as the Microsoft Developer Network provide a good overview, and the WikiBook [Visual Basic] provides an excellent guide for those with some experience in programming.

It may be useful for those new to programming to read the following section, however, those with experience in Visual Basic Programming should skip to the next section.

Getting Ready

edit

Let's get started and open up Visual Basic Express (In the Prerequisites section). The program should look like this (arrangements of toolbars may vary): (IMAGE1) Hit CTRL+N to start a new project. This window allows you to choose a project to start.

(IMAGE2)

Most courses start on Consoles (text only), but we're going to start with a Windows Forms Application. We want to create something which looks good (rather than a console window). Double Click the 'Windows Forms Application' to open a new application. You should see this:

(IMAGE3)

Look at the 'Solution Explorer' Panel. This shows all the parts of the program. We have "Windows Application 1", a default name for the program. This contains "My Project" and "Form1.vb". My Project is a set of instructions which tell the computer to run your 'form' (programmer jargon for a window). Form1.vb is a form which you can edit. This has 2 parts: Design and Code. You can switch between these by using these buttons in the Solution Explorer:

(IMAGE4)

Let's look at the code by pressing the View Code Button. (IMAGE5) You can see a text document. This contains some instructions already built in. It should say:

 Public Class Form1
 
End Class

This is simply a way to start and stop the code. Form 1 is a "Class", basically this means that it can contain other bits of code. Making it Public means that other bits of code can refer to it (e.g. If you made another form it could get information from form1). You'll come across Private code later; this is code which can only be accessed by things in the same form.