vb界面设计(续)

#界面设计注册部分
点击注册后会显示
在这里插入图片描述
输入完成后点击注册按钮则会显示注册成功字样

代码如下
Private Sub Text2_GotFocus() 'getfocus的用法不会的可以查百度
Label7.Caption = “密码的长度不得超过8位!”
Text2.Locked = False
End Sub
Sub Text1_KeyPress(KeyAscii As Integer)
Dim f%
f = 0
If KeyAscii = 13 Then
If IsNumeric(Text1) Then
Text1.text = “”
MsgBox (“姓名中不得包含数字!”)
Text1.SetFocus
f = 1
End If
If f = 0 And Text1.text = “” Then
Text1.text = “”
MsgBox (“请输入姓名!”)
End If
If f = 0 And Text1.text <> “” Then
Text2.SetFocus
End If
If Text1.text <> “” Then
Label7.Caption = “密码的长度不得超过8位!”
End If
End If
End Sub
Private Sub Text1_LostFocus()
If IsNumeric(Text1) Then
Text1.text = “”
MsgBox (“姓名中不得包含数字!”)
Text1.SetFocus
End If
If Text1.text = “” Then
Text1.text = “”
MsgBox (“请输入姓名!”)
Text1.SetFocus
End If
If Text1.text <> “” Then
Label7.Caption = “密码的长度不得超过8位!”
End If
End Sub
Sub Text2_KeyPress(KeyAscii As Integer)
Dim f%
f = 0
If KeyAscii = 13 Then
If Len(Text2.text) > 8 Then
MsgBox (“密码长度不得超过8位!”)
Text2.text = “”
f = 1
Text2.SetFocus
Label7.Caption = “密码的长度不得超过8位!”
End If
If f = 0 And Text2.text = “” And Text1.text <> “” Then
MsgBox (“请输入密码!”)
Text2.SetFocus
End If
If f = 0 And Text2.text <> “” Then
Text3.SetFocus
End If
End If
Label7.Caption = “”
End Sub
Private Sub Text2_LostFocus()
Dim f%
f = 0
If Len(Text2.text) > 8 Then
MsgBox (“密码长度不得超过8位!”)
Text2.text = “”
f = 1
Text2.SetFocus
End If
If Text2.text = “” And Text1.text <> “” And f = 0 Then
MsgBox (“请输入密码!”)
Text2.SetFocus
End If
Label7.Caption = “”
End Sub
Sub Text3_KeyPress(KeyAscii As Integer)
Dim f%
f = 0
If KeyAscii = 13 Then
If Text3.text <> Text2.text And Text2.text <> “” And Text3.text <> “” Then
MsgBox (“第二次输入的密码不正确!”)
Text3.text = “”
f = 1
End If
If f = 0 And Text3.text = “” And Text2.text <> “” And Text1.text <> “” Then
MsgBox (“请再次输入密码!”)
End If
If f = 0 And Text3.text <> “” Then
Text4.SetFocus
End If
End If
End Sub
Private Sub Text3_LostFocus()
Dim f%
f = 0
If Text3.text <> Text2.text And Text2.text <> “” And Text3.text <> “” Then
MsgBox (“第二次输入的密码不正确!”)
Text3.text = “”
f = 1
End If
If Text3.text = “” And Text1.text <> “” And Text2.text <> “” And f = 0 Then
Text3.text = “”
MsgBox (“请再次输入密码!”)
End If
End Sub
Sub Text4_KeyPress(KeyAscii As Integer)
Dim f%
f = 0
If KeyAscii = 13 Then
If Text4.text = “” And Text1.text <> “” And Text2.text <> “” And Text3.text <> “” Then
MsgBox (“请输入手机号!”)
f = 1
Text4.SetFocus
End If
If f = 0 And Text1.text <> “” And Text2.text <> “” And Text3.text <> “” Then
Text5.SetFocus
End If
End If
End Sub
Private Sub Text4_LostFocus()
If Text4.text = “” And Text1.text <> “” And Text2.text <> “” And Text3.text <> “” Then
MsgBox (“请输入手机号!”)
Text4.text = “”
Text4.SetFocus
End If
End Sub
'Sub Text5_KeyPress(KeyAscii As Integer)
’ Dim f%
’ f = 0
’ If KeyAscii = 13 Then
’ If Text5.Text = “” And Text1.Text <> “” And Text2.Text <> “” And Text3.Text <> “” And Text4.Text <> “” Then
’ MsgBox (“请输入邮箱!”)
’ f = 1
’ Text5.SetFocus
’ End If
’ If f = 0 And Text1.Text <> “” And Text2.Text <> “” And Text3.Text <> “” And Text4.Text <> “” Then
’ Command1.SetFocus
’ End If
’ End If
'End Sub
Private Sub Timer1_Timer()
Label8.Caption = Now()
End Sub

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱编程的小黑

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值