Xuân Thanh > 12-12-13, 03:42 PM
Option Explicit
Private Sub Form_Load()
Dim A, B
Dim Check As Boolean
A = 5: B = 5'Khoi tao bien
Check = CBool(A = B)' Returns True
A = 0' Define variable.
Check = CBool(A)' Returns False
End Sub
Option Explicit
Private Sub Form_Load()
Dim MyDate, MyShortDate, MyTime, MyShortTime
MyDate = "August 10, 2003"' Khoi tao
MyShortDate = CDate(MyDate)'Returns 8/10/1003
MyTime = "4:35:47 PM"' Khoi tao
MyShortTime = CDate(MyTime)'Returns 4:35:47 PM
End Sub
Option Explicit
Private Sub Form_Load()
Dim MyCurr, MyDouble
MyCurr = CCur(234.456784)
MyDouble = CDbl(MyCurr * 8.2 * 0.01)
End Sub
Option Explicit
Private Sub Form_Load()
Dim MyChar
MyChar = ChrW(65)' Returns A.
MyChar = ChrW(97)' Returns a.
MyChar = ChrW(62)' Returns >.
MyChar = ChrW(37)' Returns %.
End Sub
Xuân Thanh > 14-12-13, 10:43 AM
Option Explicit
Private Sub Form_Load()
Dim MyDouble, MyInt
MyDouble = 2345.5678' Khoi tao
MyInt = CInt(MyDouble)' Returns 2346.
End Sub
Option Explicit
Private Sub Form_Load()
Dim MyVal1, MyVal2, MyLong1, MyLong2
MyVal1 = 25427.45: MyVal2 = 25427.55' Khoi tao
MyLong1 = CLng(MyVal1)'Returns 25427.
MyLong2 = CLng(MyVal2)'Returns 25428.
End Sub
Option Explicit
Private Sub Form_Load()
Dim MyDouble1, MyDouble2, MySingle1, MySingle2
MyDouble1 = 75.3421115: MyDouble2 = 75.3421555' khoi tao
MySingle1 = CSng(MyDouble1)' Returns 75.34211.
MySingle2 = CSng(MyDouble2)' Returns 75.34216.
End Sub
Option Explicit
Private Sub Form_Load()
Dim MyDouble, MyString
MyDouble = 437.324' Khoi tao
MyString = CStr(MyDouble)' Returns "437.324".
End Sub
Option Explicit
Private Sub Form_Load()
Dim MyInt, MyVar
MyInt = 4534' MyInt is an Integer.
MyVar = CVar(MyInt & "000")' MyVar contains the string 4534000.
End Sub
khanghychu > 21-01-16, 11:06 AM