计算机一级b试题选择题,计算机一级b试题60道题答案.doc

本文介绍了一个Visual Basic for Applications (VBA)程序,展示了如何使用Date对象获取当前日期的年、月、日和星期,并通过Command按钮实现Abs、Sqr、Fix、Int和Log等数学函数的计算。同时,还涉及口令验证功能,确保系统的安全性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值