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
總結
- 上一篇: 官狼服务器临时维护,官狼三分钟新模式,跑
- 下一篇: 用C语言模拟栈(简单实现)