
open a txt file for the user to view and read
Open a new Standard EXE project in VB6. Drag one each of Drive,
Directory, and File list boxes onto the form. Add the Microsoft
RichTextBox to your component list click Project menu item and then
click Components) and drag one onto the form. Then open the code for
the form and copy in the following code shown below. You will have a
fully functional file selection/display program. On your own you can
preset directories if you want, change the File Pattern (which is set
to *.txt in the Form_Load event), etc.
------------------------------------------------------
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_DblClick()
If File1.ListIndex > -1 Then
fil$ = File1.Path
If Right$(fil$, 1) <> "\" Then fil$ = fil$ + "\"
fil$ = fil$ + File1.List(File1.ListIndex)
RichTextBox1.FileName = fil$
End If
End Sub
Private Sub Form_Load()
File1.Pattern = "*.txt"
End Sub
------------------------------------------------------------