Jump to content

Visual Basic/Introduction

From Wikibooks, open books for an open world

How to use this book

[edit | edit source]

The first page of the book is an annotated contents list, click the headings with the mouse to go to the page you want to read.

  • You will often see Visual Basic abbreviated to VB, and for the purpose of conciseness, this guide will use VB from this point onwards.
  • VB code is written in US English. There are some key differences you should note, as misspelling code can cause hours of problems. Below is a list of the differences- when writing in VB, you should use the right-hand column's spellings:

Many of these words you will not need until you progress into more complex VB

Commonwealth English US English (VB)
AnalyseAnalyze
CentimetresCentimeters
CentreCenter
ColourColor
Co-ordinatesCoordinates
Grey(ed)Gray(ed)
LicenceLicense
MillimetresMillimeters

Words which can be spelled with an 'ise' and 'ize' suffix should be spelled with 'ize' in VB.

This book will guide you step-by-step through Visual Basic. Some chapters of this book contain exercises. The exercises are an integral part of the text and at least some should be tried or you will not get the full benefit of the book. There are no answers to the exercises because most do not have a single correct answer. Physical exercises are done to build muscle and stamina, intellectual exercises are the same thing for the brain. In almost every case you should be able to think of at least two 'solutions'. Some exercises require you to write code, please write it and execute it, others expect you to think about or describe something, please write it down even if only on a piece of scrap paper, it helps fix it in your mind.

If you try an exercise and fail to find a solution please ask for help by adding a comment to the relevant discussion page. It is of course entirely possible that the exercise is faulty so reports of problems will help the authors too.

Terminology

[edit | edit source]

Please refer to the Glossary for definitions of any unfamiliar words or any words that appear to be used in an unusual sense.

VB Integrated Development Environment

[edit | edit source]

Visual Basic has several key components you will need to get acquainted with. The first is the tool box, usually located on the left of the screen. This is used for creating objects on your form. A form is the basic window a user will see upon running your program. What is on the form is what the user sees. Make some picture boxes and command buttons on your screen by clicking the button, then clicking and dragging where you want the object to be placed. The next key feature is the properties of objects. Captions, names, and other properties of objects may be edited here. Now, click an object, and a white window will appear. This is where your code goes. Toward the top of your screen you should see a "play" button, but in Visual Basic it is referred to as the "Run" button. This will run any programs you make. Next to it are the pause, and stop buttons, which are pretty self explanatory.


Previous: Contents Next: History