Visual Basic

Posted:
January 24th, 2013, 10:33 pm
by Jessica
Before you can begin programming, you must understand the concept of variables. Variables are the storage media within programs. For example if you wanted the program to know the user's name, then you might declare a variable called
strName, ask the user for their name, and then store the result into the
strName variable.
Declaring a variableBefore you can use a variable, you have to declare the variable. In Visual Basic you use the Dim statement to declare variables. Some common variable types are Integer, and String. This is how you use the Dim statement.
Dim [variable name] As [variable type]
Examples:
Dim strName As String
Dim intCounter As Integer
Re: Visual Basic

Posted:
January 29th, 2013, 9:32 pm
by Jessica
An event procedure is invoked when something happens to a specified object. Some events are object.Click (object is clicked), object.TextChanged (a change occurred in the value of the object's Text property), object.Leave (object loses the focus), and object.Enter (object receives the focus).
Re: Visual Basic

Posted:
January 29th, 2013, 9:44 pm
by Jessica
Standard Naming Conventions
These are the prefixes for the data types used in Visual Basic.
| Data Type | Prefix | Example |
| Boolean | bln | blnFound |
| Currency | cur | curTotal |
| Date (time) | dat | datStart |
| Double | dbl | dblTolerance |
| Error | err | errNumber |
| Integer | int | intQuantity |
| Long | lng | lngDistance |
| Object | obj | objCurrent |
| Single | sng | sngAverage |
| String | str | strFullName |
| User-Defined type | udt | udtEmployee |
| Variant | vnt | vntCheckSum |
Re: Visual Basic

Posted:
January 29th, 2013, 9:45 pm
by Jessica
Common Data Types Defined
These are the most commonly used data types.
Integer: the most commonly used data type. It can only store whole number integers within the range -32,768 to 32,767.
Long: same as Integer, but with a range of -2,147,483,648 to 2,147,483,647. For most practical uses Integer will do just fine, and there is no need for using Long, however there are some cases when the range of Integer just won't cut it.
String: the second most commonly used data type. It stores a "String" of characters. In Visual Basic, a string is contained within quotes "".
Single: represents a floating point number, or in other words a number with a decimal. It has a range of -3.402823e38 to -1.401298e-45 for negative numbers, and 1.401298e-45 to 3.402823e38 for positive numbers.
Double: same as Single except with a range of -1.79769313486232e308 to -4.94065645841247e-324 for negative numbers, and a range of 4.94065645841274e-324 to 1.79769313486232e308 for positive numbers. Double like Long is just a bigger variable type, in most instances there is no need for the precision that the double types can support, but in some cases it may be necessary.
Boolean: represents either True or False