窗体内画个drivelistbox dirlistbox和filelistbox 再放两个按钮 caption分别为打开 保存,再放一个文本框控件 multiline设为true scrollbar设成2
加入下面代码
Option Explicit
Private Sub Command1_Click() '打开文件
Dim FN As String
FN = Replace(File1.Path & "\" & File1.FileName, "\\", "\")
Text1 = OpenTxt(FN)
End Sub
Private Sub Command2_Click() '保存文件
Dim FN As String
FN = Replace(File1.Path & "\" & File1.FileName, "\\", "\")
Open FN For Output As #1
Print #1, Text1
Close #1
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
File1.Path = Dir1.Path
End Sub
Private Sub Form_Load()
File1.Pattern = "*.txt"
End Sub
Private Function OpenTxt(ByVal FN As String) As String
Open FN For Binary As #1
OpenTxt = Input(LOF(1), 1)
Close #1
End Function
温馨提示:答案为网友推荐,仅供参考