zxpr.net
当前位置:首页 >> vB编写程序假设正确密码 >>

vB编写程序假设正确密码

先设计好界面,(如:用标签控件,2个文本框,)在1个要输密码文本框的属性名称中输入password,在要输入名称的文本框的属性名称中输入username.在设置字体 想要输入错误密码三次退出程序方法如下; 在密码的代码框中输入:unload.me chick=3. End sub

新建工程---添加一个commandbuton控件~双击窗体进入代码编辑区~复制一下代码 Private Sub Command1_click() Const Pwd = "123456" '改成密码 x = InputBox("内容", "标题", "输入栏内容") If x = Pwd Then MsgBox "密码正确" Else MsgBox "密码错误" End If end sub 按f5运行 点击按钮 看到效果.

private sub command1_click() static a as integer if text1.text = "12345" then msgbox "密码正确" else a = a + 1 if a = 3 then msgbox "因多次错误操作,信用卡被没收!" text1.enabled = false exit sub end if msgbox "密码错误" end if end sub

只做个提示:textbox1.UseSystemPasswordChar属性设置为true如果想要完整的程序,给人的感觉就是不劳而获.

Private Sub Command1_Click() a = InputBox("请输入密码", "请输入") If a = "123" Then Shell "Notepad.exe", vbNormalFocusEnd Sub

'三次机会,如果都不正确退出 ,测试一下:Private Sub Form_Load() Dim i As Integer, password As String, s As String, n As Integer password = "123" For i = 1 To 3 s = InputBox("输入密码:", "提示") If s = password Then Exit For Next If i = 4 Then Unload Me End Sub

刚刚写过了类似的代码 ,算了 再写下 Private Sub Command1_Click() Static i As Integer '说明下,假设 用户名、密码 分别是 yutian8802和 123456 If i > 2 Then MsgBox "您已登录三次了程序将结束!" End Else If Text1.Text = "yutian

创建 Combo1 、Text1、Command1Private Sub Command1_Click()If Combo1.Text = "teacher" And Text1.Text = "gong" Then MsgBox ("恭喜,用户密码正确!") Else MsgBox ("对不起,用户或密码错误!")End IfEnd Sub

Private Sub Command1_Click() a = InputBox("请输入密码", "请输入") If a = "123" Then Shell "Notepad.exe", vbNormalFocusEnd Sub

在登录按钮里写代码啊 很简单 if 条件(判断账号和密码是否正确) then 系统界面.show me.close else msgbox("用户名/密码错误") end if

网站首页 | 网站地图
All rights reserved Powered by www.zxpr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com