如题,我在窗口中设置了驱动器列表框、目录列表框和组合框分别选择盘符、路径、文件类型(TXT或VBP,均为文本文件),在文件列表框中双击文件名时打开此文件并将内容显示在文本框中。
如何?
急!!!!解决了我还会追加悬赏分的!!!各位帮帮忙
我的部分代码如下:
Private Sub Form_Load()
Combo1.AddItem "文本文件(*.TXT)"
Combo1.AddItem "VBP文件(*.VBP)"
Combo1.Text = Combo1.List(0)
File1.Pattern = "*.TXT"
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Combo1_Click()
Select Case Combo1.ListIndex
Case 0
File1.Pattern = "*.txt"
Case 1
File1.Pattern = "*.vbp"
End Select
End Sub
Private Sub file_click()
If Right(File1.Path, 1) = "\" Then
fName = File1.Path + File1.FileName
Else
fName = File1.Path + "\" + File1.FileName
End If
Text1.Text = fName
End Sub
Private Sub file_dblclick()
Dim s$
If Right(File1.Path, 1) = "\" Then
fName = File1.Path + File1.FileName
Else
fName = File1.Path + "\" + File1.FileName
End If
Text1.Text = fName
'App.Path = fName
'Open App.Path For Append As #1
'Do While EOF(1)
'Line Input #1, s
'Text1.Text = Text1.Text & s
'Loop
'Close #1
End Sub