Monday, January 24, 2011

Variables in Visual Basic 1/24/11

Visual Basic, just like most programming languages, uses variables for storing values. A variable has a name (the word that you use to refer to the value that the variable contains). A variable also has a data type (which determines the kind of data that the variable can store). A variable can represent an array if it has to store an indexed set of closely related data items.


'Declaring a String  
Dim strGoogle As String  
'Declaring a Boolean  
Dim blnBing As Boolean  
'Declaring an Integer  
Dim intYahoo As Integer  
'Declaring a Decimal  
Dim decAsk As Decimal  
'Assigning a value to a variable  
strGoogle = "Googling"  
blnBing = False  
intYahoo = 1  
decAsk = 0.25  
'Outputting all of the values to the variables in a message box  
MessageBox.Show(strGoogle & " " & blnBing & " " & intYahoo + decAsk)  

No comments:

Post a Comment

Classes

Programming II

Advanced Relational Database

Followers