by liaqat fayyaz (10 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 8th May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
A simple and good text viewer
Private Sub cmdFile_Click()
Dim sTemp As String
dlg.FileName = "*.txt"
dlg.ShowOpen
txtFile = dlg.FileName
If Dir(dlg.FileName) <> "" Then
If FileLen(dlg.FileName) > 32000 Then
MsgBox "File is bigger then 32 KB. Don't want to show it"
Else
Me.MousePointer = vbHourglass
txtOutput = ""
Open dlg.FileName For Input As 1
While Not EOF(1)
Line Input #1, sTemp
txtOutput = txtOutput & sTemp & vbCrLf
Wend
Close #1
Me.MousePointer = vbDefault
End If
Else
MsgBox "File not found", vbCritical, "Error"
End If
End Sub
Private Sub Form_Resize()
txtOutput.Height = Me.Height - 750
txtOutput.Width = Me.Width - 120
End Sub