📄 form0405.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "学生信息"
ClientHeight = 2820
ClientLeft = 60
ClientTop = 450
ClientWidth = 4185
LinkTopic = "Form1"
ScaleHeight = 2820
ScaleWidth = 4185
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "退出(&C)"
Height = 495
Left = 2520
TabIndex = 5
Top = 2040
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
Default = -1 'True
Height = 495
Left = 720
TabIndex = 4
Top = 2040
Width = 1095
End
Begin VB.TextBox Text2
Height = 495
Left = 2040
MaxLength = 8
TabIndex = 3
Top = 1200
Width = 1335
End
Begin VB.TextBox Text1
Height = 495
Left = 2040
MaxLength = 10
TabIndex = 1
Top = 360
Width = 1335
End
Begin VB.Label Label2
Caption = "姓名:"
Height = 375
Left = 720
TabIndex = 2
Top = 1320
Width = 1095
End
Begin VB.Label Label1
Caption = "学号:"
Height = 375
Left = 720
TabIndex = 0
Top = 480
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
'单击确定按钮
MsgBox "学号为" & Text1.Text & ",姓名为" & Text2.Text, vbOKOnly, "学生信息"
End Sub
Private Sub Command2_Click()
'单击退出按钮
End
End Sub
Private Sub Text1_LostFocus()
'失去焦点
If Not IsNumeric(Text1.Text) Then
MsgBox "学号应为数字", vbOKOnly, "出错"
Text1.SetFocus
End If
End Sub
Private Sub Text2_LostFocus()
'失去焦点
If IsNumeric(Text2.Text) Then
MsgBox "姓名应为字符", vbOKOnly, "出错"
Text2.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -