1.Private Sub Form_Click()
label2.Caption = Year(Date)
label4.Caption = Month(Date)
label6.Caption = Day(Date)
label8.Caption = Weekday(Date) - 1
label11.Caption = Time
End Sub
2. Dim num As Double
Private Sub Command1_Click()
Label3.Caption = Command1.Caption & "函数的计算结果为"
Label2.Caption = Abs(num)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Command2_Click()
Label3.Caption = Command2.Caption & "函数的计算结果为"
Label2.Caption = Sqr(num)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Command3_Click()
Label3.Caption = Command3.Caption & "函数的计算结果为"
Label2.Caption = Fix(num)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Command4_Click()
Label3.Caption = Command4.Caption & "函数的计算结果为"
Label2.Caption = Int(num)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Command5_Click()
Label3.Caption = Command5.Caption & "函数的计算结果为"
Label2.Caption = Log(num)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Text1_Change()
num = Val(Text1.Text)
End Sub
3. Dim I As Integer
Private Sub Command1_Click()
kl = UCase(Trim(Text1.Text))
If kl = "ABCD" Then
I = 0
Form2.Show
Else
If I >= 2 Then
MsgBox "对不起,您不能使用本系统"
End
Else
Form1.Caption = "口令错,请重新输入!"
I = I + 1
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
End If
End Sub
Private Sub Text1_Change()
Form1.Caption = ""
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
kl = UCase(Trim(Text1.Text))
If kl = "ABCD" Then
I = 0
Form2.Show
Else
If I >= 2 Then
MsgBox "对不起,您不能使用本系统"
End
Else
Form1.Caption = "口令错,请重新输入"
I = I + 1
Text1.SelStart = 0
Text1.SelLength = Len(T