📄 随机文件读写.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "随机文件读写"
ClientHeight = 4425
ClientLeft = 60
ClientTop = 450
ClientWidth = 6615
LinkTopic = "Form1"
ScaleHeight = 4425
ScaleWidth = 6615
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "读文件"
Height = 1095
Left = 3720
TabIndex = 1
Top = 2400
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "写文件"
Height = 1095
Left = 480
TabIndex = 0
Top = 2400
Width = 2775
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Type Tele
Name As String * 15
Tel As String * 15
Pos As Long
End Type
Dim Pers As Tele
Dim RecNum As Integer
Private Sub Command1_Click()
Open "t5.txt" For Random As #1 Len = Len(Pers)
RecNum = LOF(1) / Len(Pers)
Do
Pers.Name = InputBox("请输入姓名")
Pers.Tel = InputBox("请输入电话")
Pers.Pos = InputBox("请输入邮政编码")
RecNum = RecNum + 1
Put #1, RecNum, Pers
asp = InputBox("More(Y/N)?")
Loop While UCase(asp) = "Y"
Close #1
End Sub
Private Sub Command2_Click()
Open "t5.txt" For Random As #1 Len = Len(Pers)
RecNum = LOF(1) / Len(Pers)
Cls
For i = 1 To RecNum
Get #1, i, Pers
Print Pers.Name; Pers.Tel; Pers.Pos
Next i
Close 1
End Sub
Private Sub Form_Load()
Command1.FontSize = 18
Command2.FontSize = 18
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -