5.3.frm
来自「VB6.0应用例题」· FRM 代码 · 共 218 行
FRM
218 行
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "考生登录"
ClientHeight = 3570
ClientLeft = 45
ClientTop = 330
ClientWidth = 3300
Icon = "5.3.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3570
ScaleWidth = 3300
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "正确无误"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 840
TabIndex = 6
Top = 2880
Width = 1695
End
Begin VB.TextBox TxtSeat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 4
Top = 1800
Width = 1740
End
Begin VB.TextBox Txtname
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 5
Top = 1080
Width = 1740
End
Begin VB.TextBox Txtcode
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
MaxLength = 8
TabIndex = 3
Top = 360
Width = 1740
End
Begin VB.Label Lblsm
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 120
TabIndex = 7
Top = 2400
Width = 3015
End
Begin VB.Label Label3
Caption = "座位号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 2
Top = 1920
Width = 975
End
Begin VB.Label Label2
Caption = "准考证号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 1
Top = 480
Width = 975
End
Begin VB.Label Label1
Caption = "姓 名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 0
Top = 1200
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Len(Txtcode.Text) < 8 Then
Lblsm.Caption = "准考证号必须输入,长度8位!"
Txtcode.SetFocus
ElseIf Len(Txtname.Text) = 0 Then
Lblsm.Caption = "考生姓名必须输入"
Txtname.SetFocus
Exit Sub
ElseIf Len(TxtSeat.Text) = 0 Then
Lblsm.Caption = "座位号必须输入"
TxtSeat.SetFocus
Exit Sub
End If
Lblsm.Caption = ""
MsgBox "正确"
End Sub
Private Sub Txtcode_LostFocus()
'-------------------------------------------------------
' 检查准考证号是否输入8位数字
'-------------------------------------------------------
If Len(Txtcode.Text) < 8 Then 'Len()是判断字符串长度函数
Lblsm.Caption = "准考证号必须输入,长度8位!"
Txtcode.SetFocus
ElseIf Not IsNumeric(Txtcode.Text) Then 'IsNumeric()是判断数字函数
Lblsm.Caption = "准考证号必须是数字!"
Txtcode.SetFocus
Else
Lblsm.Caption = ""
End If
End Sub
Private Sub Txtname_LostFocus()
'-------------------------------------------------------
' 检查考生姓名是否输入
'-------------------------------------------------------
If Len(Txtcode.Text) < 8 Or Not IsNumeric(Txtcode.Text) Then
Txtcode.SetFocus
ElseIf Len(Txtname.Text) = 0 Then
Lblsm.Caption = "考生姓名必须输入!"
Txtname.SetFocus
Else
Lblsm.Caption = ""
End If
End Sub
Private Sub TxtSeat_LostFocus()
'-------------------------------------------------------
' 检查座位号是否输入,且座位号为数字
'-------------------------------------------------------
If Len(Txtname.Text) = 0 Then
Txtname.SetFocus
ElseIf Len(TxtSeat.Text) = 0 Then
Lblsm.Caption = "座位号必须输入!"
TxtSeat.SetFocus
ElseIf Not IsNumeric(TxtSeat.Text) Then
Lblsm.Caption = "座位号必须是数字"
TxtSeat.SetFocus
Else
Lblsm.Caption = ""
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?