| What do you want to do? | Syntax Examples | |||||||||||||||||||||||||||
A |
Top |
|||||||||||||||||||||||||||
| B | Top |
|||||||||||||||||||||||||||
| C | Top |
|||||||||||||||||||||||||||
| Clearing a ListBox | ListBox1.Items.Clear Clears the contents of a ListBox | |||||||||||||||||||||||||||
| Creating a Comment | 'Comment - use an apostrophe at the begriming of the line. The computer will ignore whatever comes after it on the same line. It should appear as green. | |||||||||||||||||||||||||||
| D | Top |
|||||||||||||||||||||||||||
| Declaring Variables - Do this at the very top of the program just below Public Class Form1(). | Dim Number as Integer. - Creates a variable called Number that stores whole numbers, so that values like 3.33, 104.75 are stored as 3 and 104. Dim Number as Decimal - Creates a variable called Number that can hold decimal numbers, so that values like 3.33 and 104.75 are stored as 3.33 and 104.75. Dim aString as String - Creates a variable called aString that can store text. |
|||||||||||||||||||||||||||
| E | Top |
|||||||||||||||||||||||||||
| F | Top |
|||||||||||||||||||||||||||
| G | Top |
|||||||||||||||||||||||||||
| Grabbing the contents from a TextBox and placing in a variable | Number = TextBox1.Text, Name = TextBox1.Text Takes the contents of TextBox1 (numbers or text) and stores in a variable. |
|||||||||||||||||||||||||||
| H | Top |
|||||||||||||||||||||||||||
| I | Top |
|||||||||||||||||||||||||||
| Using Input Boxes | Name = InputBox("What is your Name?") - Displays a box with a question. What the user then enters is stored in a variable called Name. | |||||||||||||||||||||||||||
| Using Message Boxes | MesgBox("You entered " & Name) - Displays a box with a statement and the contents of the variable called Name. | |||||||||||||||||||||||||||
| J | Top |
|||||||||||||||||||||||||||
| K | Top |
|||||||||||||||||||||||||||
| L | Top |
|||||||||||||||||||||||||||
| Loops - repeats a number actions. There are different types of Loops. | For... Next Loops - repeats instructions a set number of times. It looks like this
|
|||||||||||||||||||||||||||
| Adding Items to a ListBox. | ListBox1.Items.Add("The answer is " & answer) - Displayed the listbox with the text "The answer is " with the contents of the Variable called answer | |||||||||||||||||||||||||||
| M | Top |
|||||||||||||||||||||||||||
| N | Top |
|||||||||||||||||||||||||||
| O | Top |
|||||||||||||||||||||||||||
| Creating Objects. | Find the object you want, Label, ListBox, Command button, TextBox in the Tool sidebar and drag onto your form. Rearrange them to your liking. | |||||||||||||||||||||||||||
| P | Top |
|||||||||||||||||||||||||||
| Q | Top |
|||||||||||||||||||||||||||
| R | Top |
|||||||||||||||||||||||||||
| S | Top |
|||||||||||||||||||||||||||
| Setting a string variable to empty. | Dim Name as string - sets up a string variable. Name = String.Empty - clears or sets the Name variable to empty. |
|||||||||||||||||||||||||||
| Creating a subroutine. | Simples. Just write the name you wish to use in the main program with round brackets Eg. Get_Scores() and then use as part of declaration of the sub routine. eg Private Sub Get_Scores() score1 = TextBox1.Text End Sub |
|||||||||||||||||||||||||||
| T | Top |
|||||||||||||||||||||||||||
| U | Top |
|||||||||||||||||||||||||||
| V | Top |
|||||||||||||||||||||||||||
| W | Top |
|||||||||||||||||||||||||||
| X | Top |
|||||||||||||||||||||||||||
| Y | Top |
|||||||||||||||||||||||||||
| Z | Top |
|||||||||||||||||||||||||||