
Private Sub Command1_Click()
Static n As Long, m As Long
m = Val(Text2)
n = n + 1
If Text1 = "psw123" Then
MsgBox "口令正确", vbExclamation, "登录"
n = 0
Else
If n >= m Then
MsgBox n & "次输入错误,请退出", vbExclamation, "登录"
End
Else
MsgBox "第" & n & "次口令输入错误,请重新输入", vbExclamation, "登录"
Text1SetFocus
End If
End If
End Sub
Private Sub Form_Load()
Label1Caption = "口令:"
Label2Caption = "允许输入口令的次数:"
Command1Caption = "确定"
MeCaption = "登录"
Text1 = ""
Text1PasswordChar = ""
Text2 = 3
End Sub
试题一1
Private Sub Form_Click()
Print fs_sum(100)
End Sub
Function fs_sum(ByVal n As Integer) As Single
Dim s!, nc! '和与倒数
s=0
For i = 1 To n
nc = 1 / i
s = s + nc
Next i
fs_sum = s
End Function
试题一2
Private Sub Form_Click()
For i = 1 To 4
Print Space(4 - i);
For j = 1 To i
Print " ";
Next j
Next i
End Sub
待续,未完
以上就是关于VB程序设计全部的内容,包括:VB程序设计、vb程序设计实例100、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)