📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form Form3
ClientHeight = 5130
ClientLeft = 5850
ClientTop = 3405
ClientWidth = 8445
LinkTopic = "Form3"
ScaleHeight = 5130
ScaleWidth = 8445
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 855
Left = 4560
TabIndex = 18
Top = 1080
Width = 1935
Begin VB.OptionButton Option1
Height = 255
Left = 360
TabIndex = 20
Top = 360
Width = 495
End
Begin VB.OptionButton Option2
Caption = "Option2"
Height = 255
Left = 1080
TabIndex = 19
Top = 360
Width = 615
End
End
Begin VB.TextBox Text1
Height = 495
Index = 5
Left = 1920
TabIndex = 10
Text = "Text1"
Top = 3720
Width = 6135
End
Begin VB.TextBox Text1
Height = 495
Index = 4
Left = 1920
TabIndex = 9
Text = "Text1"
Top = 3000
Width = 4455
End
Begin VB.TextBox Text1
Height = 495
Index = 3
Left = 1920
TabIndex = 8
Text = "Text1"
Top = 2280
Width = 4455
End
Begin VB.TextBox Text1
Height = 495
Index = 2
Left = 1920
TabIndex = 7
Text = "Text1"
Top = 1560
Width = 2535
End
Begin VB.TextBox Text1
Height = 495
Index = 1
Left = 1920
TabIndex = 6
Text = "Text1"
Top = 960
Width = 2535
End
Begin VB.TextBox Text1
Height = 495
Index = 0
Left = 1920
MaxLength = 3
TabIndex = 0
Text = "Text1"
Top = 240
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 6720
TabIndex = 4
Top = 840
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 495
Left = 6720
TabIndex = 3
Top = 1560
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "Command3"
Height = 495
Left = 6720
TabIndex = 2
Top = 2280
Width = 1335
End
Begin VB.CommandButton Command4
Caption = "Command4"
Height = 495
Left = 6720
TabIndex = 1
Top = 3000
Width = 1335
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "已存储了学号从001-008八位同学的数据"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 300
Left = 480
TabIndex = 17
Top = 4440
Width = 5250
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 5
Left = 360
TabIndex = 16
Top = 3720
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 4
Left = 360
TabIndex = 15
Top = 3120
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 3
Left = 360
TabIndex = 14
Top = 2400
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 2
Left = 360
TabIndex = 13
Top = 1680
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 1
Left = 360
TabIndex = 12
Top = 960
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 0
Left = 360
TabIndex = 11
Top = 360
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
BeginProperty Font
Name = "隶书"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 360
Index = 6
Left = 3720
TabIndex = 5
Top = 360
Width = 1080
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim h As Integer
Private Type cj
a As String * 3
b As String * 8
c As String * 10
d As String * 15
e As String * 30
f As String * 30
g As Boolean
h As Boolean
End Type
Dim you As Integer
Private da As cj
Private Sub Command1_Click()
Open App.Path & "\456.dat" For Random As #1 Len = Len(da)
you = LOF(1) / Len(da)
For n = 1 To you
Get #1, n, da
m = 0
If da.a = Text1(0) Then
Text1(0).Text = da.a
Text1(1).Text = da.b
Text1(2).Text = da.c
Text1(3).Text = da.d
Text1(4).Text = da.e
Text1(5).Text = da.f
Option1.Value = da.g
Option2.Value = da.h
m = 1
Exit For
End If
Next n
If m = 0 Then
For y = 1 To 5
Text1(y).Text = ""
Next y
MsgBox "数据不存在", 0 + 48, "提示"
End If
h = n
Close #1
End Sub
Private Sub Command2_Click()
For n = 0 To 5
Text1(n).Text = ""
Next n
Option1.Value = False
Option2.Value = False
Form3.Hide
End Sub
Private Sub Command3_Click()
Command4.Enabled = True
h = h - 1
Open App.Path & "\456.dat" For Random As #1 Len = Len(da)
If h = 0 Then
Command3.Enabled = False
For n = 0 To 5
Text1(n).Text = ""
Next n
MsgBox "已无记录", 0 + 48, "提示"
Else
Get #1, h, da
Text1(0).Text = da.a
Text1(1).Text = da.b
Text1(2).Text = da.c
Text1(3).Text = da.d
Text1(4).Text = da.e
Text1(5).Text = da.f
Option1.Value = da.g
Option2.Value = da.h
End If
Close #1
End Sub
Private Sub Command4_Click()
Command3.Enabled = True
h = h + 1
Open App.Path & "\456.dat" For Random As #1 Len = Len(da)
If h > you Then
Command4.Enabled = False
For n = 0 To 5
Text1(n).Text = ""
Next n
MsgBox "已无记录", 0 + 48, "提示"
Else
Get #1, h, da
Text1(0).Text = da.a
Text1(1).Text = da.b
Text1(2).Text = da.c
Text1(3).Text = da.d
Text1(4).Text = da.e
Text1(5).Text = da.f
Option1.Value = da.g
Option2.Value = da.h
End If
Close #1
End Sub
Private Sub Form_Load()
Option1.Value = False
Option2.Value = False
Form3.Caption = "信息检索"
Label1(0).Caption = "学号"
Label1(1).Caption = "姓名"
Label1(2).Caption = "年龄"
Label1(3).Caption = "出生年月"
Label1(4).Caption = "联系电话"
Label1(5).Caption = "家庭住址"
Label1(6).Caption = "按3位学号查询"
With Frame1
.Caption = "性别"
.FontSize = 16
.Font = "隶书"
End With
With Option1
.Caption = "男"
.FontSize = 12
.Font = "隶书"
End With
With Option2
.Caption = "女"
.FontSize = 12
.Font = "隶书"
End With
Dim n As Integer
For n = 0 To 5
Label1(n).FontSize = 16
Label1(n).Font = "隶书"
Next
Dim m As Integer
For m = 0 To 5
Text1(m).Text = ""
Text1(m).FontSize = 16
Text1(m).Font = "隶书"
Next m
Command1.Caption = "确定(&Q)"
Command2.Caption = "取消(&C)"
Command3.Caption = "上一记录"
Command4.Caption = "下一记录"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -