Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• Adjust flexgrid cell
• Animation
• Centering form text
• Coffee machine
• Creating fileshares
• Creating shortcuts
• Custom buttons
• Directory browser
• Disable mouse events
• File search by ext
• File transfer
• File watcher
• Formatting flexgrid
• Get Content Type
• Get HTML source
• Get modem port
• HTTP proxy
• ipconfig
• Large file split/merge
• MAPI
• MCI Sound Player
• Menu with images
• MP3 normalizer
• Net Send
• Netstat 2000
• No duplicate entries
• Outlook Address Book
• Set font color
• Shapes
• SOAP test
• Text-to-image
• Text file viewer
• Text find/replace
• UPS component
• View NT groups
• Word template
• Writing DNS control
    • Using DNS control
• Writing SMTP control
    • Sending email
    • Mailing list
• Writing WhoIs control
    • Using WhoIs control
• View HTML source
OISV - Organization of Independent Software Vendors - Contributing Member
VB projects - Text File Viewer

Description: shows specified text file
Minimum requirements: VB5
Download: source code
Screenshot:
View Text File (6 KB)
Project: Standard EXE
ActiveX Controls/Objects: comdlg32.ocx
Controls: dlg (CommonDialog), cmdFile (CommandButton), txtFile (TextBox), txtOutput (TextBox)
Code:
Option Explicit

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

Copyright © 1996-2013 OstroSoft. All rights reserved. info@ostrosoft.com