Option Explicit Private Sub Write_Click() '讀取 On Error GoTo ErrHandler Form1.CommonDialog1.ShowOpen Dim OpenFile, MyString As String OpenFile = CommonDialog1.FileName Open OpenFile For Input As #1 Do While Not EOF(1) Line Input #1, MyString Text1.Text = Text1.Text & MyString & vbCrLf Loop Close #1 ErrHandler: Exit Sub End Sub Private Sub Save_Click() '保存 On Error GoTo ErrHandler Form1.CommonDialog1.ShowSave Dim SaveFile As String SaveFile = CommonDialog1.FileName Open SaveFile For Output As #1 Print #1, Text1.Text Close #1 ErrHandler: Exit Sub End Sub |
|