⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 随机文件读写.frm

📁 蒋加伏主编VB程序设计第四版PPT及全部课本源码 北京邮电大学出版社 Visual Basic 程序设计教程(第四版) 主编 蒋加伏 张林峰 找了好久的(不带密码的)
💻 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 + -