We can assign values to those variables,after declaring various variables using the Dim statements.
A D V E R T I S E M E N T
The general format of an assignment is
variable=Expression and the variable can be a declared variable or a control property value. The expression could be a mathematical expression, a number, a string, a Boolean value ( false or true) and etc.
The following are some examples:
We need to use various mathematical operators in order to compute inputs from users and to generate results.In Visual Basic, except for + and -, the symbols for the operators are different from normal
mathematical operators as shown in following table:
Operator
Mathematical function
Example
^
Exponential
2^4=16
*
Multiplication
4*3=12
/
Division
12/4=3
Mod
Modulus(return the
remainder from an integer division)
15 Mod 4=3
\
Integer Division(discards
the decimal places)
19\4=4
+ or &
String concatenation
"Visual"&"Basic"="Visual
Basic"
The following example describe the use of operator in VB
Dim firstName As String
Dim secondName As String
Dim yourName As String
Private Sub Command1_Click()
firstName = Text1.Text
secondName = Text2.Text
yourName = secondName + " " + firstName
Label1.Caption = yourName
End Sub
In this example, three variables are declared as string and for variables secondName and firstName will receive their data from the user�s input into textbox1 and textbox2, and
the variable yourName will be assigned the data by combining the first two variables.
Finally, yourName is displayed on the Label1.
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
Working With Variables,
asp net variables,
shell script variables,
php variables,
mysql variables,
working with php,
perl variables,
unix variables,
asp variables,
working with mysql,
bash variables,
javascript variables,
linux variables,
echo variables,
working with unix,
working with perl,
working with asp,
working with excel,
working with iis,
working with xml,
shell variables,
url variables