Data Types and Variables Lesson 6!. Data Type!. Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures. Visual Basic supports the following data types: Data Type Range Whole Number: Integer-32,768 to 32,767 Long-2,147,483,648 to 2,147,483,647
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Data Types and VariablesLesson 6!
Computers are all about Data!
Data can be in the form of
Visual Basic supports the following data types:
Integer-32,768 to 32,767
String1 to about 65,000
DateJanuary 1, 100 to
December 31, 9999
BooleanTrue or False
Memory locations where temporary data is stored.
To declare a variable, use the Dim statement as show below.
Dim VariableName As DataType
The following declare a variable named intAnswer with the Integer data type.
Dim intAnswer As Integer
When naming variables, keep the following rules in mind.
Open VB and create a new form the looks like the following:
Label1 should be lblAgeYears
Label2 should be lblMonths
Label3 should be lblYou
Label4 should be lblOutputMonths
Label5 should be lblAgeMonths
Age in years:
Months since last birthday
lblYou, lblOutputMonths, lblAgemonths
intMonths = (Val(txtYears.Text) * 12) + _
'Display Number of Months Old
lblOutputMonths.Caption = intMonths
lblYou.Visible = True
lblOutputMonths.Visible = True
lblAgemonths.Visible = True
What is your output?
Pick up a worksheet before