VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A simple and good text viewer

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

Rate 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


Download this snippet    Add to My Saved Code

A simple and good text viewer Comments

No comments have been posted about A simple and good text viewer. Why not be the first to post a comment about A simple and good text viewer.

Post your comment

Subject:
Message:
0/1000 characters