例35:登录界面设计(密码以*显示,三次输入不正确,锁定登录按钮)

  1. 设计窗体,控件安排如图31:

    例35:登录界面设计(密码以*显示,三次输入不正确,锁定登录按钮)_第1张图片

                         图31

  1. 代码如下:
Sub Form1_Command1_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)

   Static n As Integer

   If Text1.Text = "abc" And Text2.Text = "123" Then

      MsgBox("欢迎光临!")

   Else

      n = n + 1

      If n = 3 Then

         MsgBox("您无权登录!")

         Command1.Enabled=False

      Else

         MsgBox("用户名或密码错误!")

      End If

   End If

End Sub

Sub Form1_Command2_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)

   End

End Sub

你可能感兴趣的:(Visual,Free,Basic例解教程,java,前端,服务器,开发语言)