form1.frm

来自「150个经典VB API应用实例.全部是运用API写的小程序」· FRM 代码 · 共 42 行

FRM
42
字号
VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   Caption         =   "Form1"
   ClientHeight    =   2295
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3495
   LinkTopic       =   "Form1"
   ScaleHeight     =   2295
   ScaleWidth      =   3495
   StartUpPosition =   3  '窗口缺省
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Dim fso As Object
Dim fso_file As Object

Private Sub Form_Load()
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fso_file = fso.OpenTextFile(App.Path + "\test.txt", ForReading, True)
    Do While Not fso_file.AtEndOfStream
        Me.Print fso_file.ReadLine
    Loop
    fso_file.Close
End Sub

Private Sub Form_Terminate()
    Set fso_file = fso.OpenTextFile(App.Path + "\test.txt", ForAppending, True)
    fso_file.WriteLine ("new line")
    fso_file.Close
    Set fso_file = Nothing
    Set fso = Nothing
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?