Number Functions - Conversion Functions
To retrieve any numbers present in a string the Val Function can be used. The Val function uses the following syntax:
Val(String)
The following code retrieves any numbers present in the given String, and adds it into a textbox
Dim Num As String
Num = “Year: 2007, date: 25″
Text1.Text = Val(Num) ‘ Text1 will contain 200725
The Int function converts a number to integer value(whole number). The following code converts the decimal number to a whole number.
Dim Num As Single
Num = 123.45
Msgbox Int(Num)
o/p : 123
Other Functions:
Int - Converts a number to a Integer
CLng - Converts a number to a Long
Hex - Converts a number to Hex
