GBIC: VB6 Data Types and Variables
The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.
VB, Like most programming languages, stores information In multipleformats. The basic Data types supported by VB are:
'Integer whole numbers -32,768 to +32,767 2 bytes
'Long whole numbers -2,147,483,648 to +2,147,483,647 4 bytes
'Single numbers with decimal points -1.4E-45 to +3.4E38 4 bytes
'Double numbers with decimal points -4.9E-324 to 1.8E308 8 bytes
'Boolean value of True or False only
'Strings sequences of characters, such as "abc123"
'Byte single character 0 to 255
'Date includes date and time
'Variant any type from the list above
'Variables are names assigned to store values. Variable naming rules are:
'1. Start with a letter
'2. Consist of letter, numbers, or an underscore '_'
'3. Cannot exceed 255 characters
'To create a variable of a certain type, use the Dim function
Dim MyString As String
MySring = "abc"
Dim Y As Integer
Y = 2
'VB also supports a user-defined type (UDT), which is a combination
'of the other types
Type Address
Address As String
City As String
State As String
Zip As String
End Type
Dim R As Address
R.Address = "101 Clover Lange"
R.City = "Tulsa"
R.State = "OK"
R.Zip = "72310"
'These VB function are available to convert 1 data type into another
Cbool (expression)
CByte (expression)
CCur(expression)
CDate (expression)
CDbl (expression)
CDec (expression)
CInt (expression)
CLng (expression)
CSng (expression)
CStr (expression)
CVar(expression)
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.