0

Hi All I do not read file content except .txt file .Can you give universal solution in vb dotnet to read content all type of file. Thanks in advance

            Dim filetoread As String = "c:\CodeNotes_NET.pdf"
            Dim filestream As StreamReader
            filestream = File.OpenText(filetoread)
            Dim readcontents As String
            readcontents = filestream.ReadToEnd()
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by thines01
1

There is no universal solution for reading all types of files.
Just like on your computer, each file type requires a different "handler".
For instance, you don't use MS Word to load, read and edit a PDF file.

So, for a PDF, you will need to use COM automation or an Acrobat dot net DLL that will allow you to open, read and print.

With that said, you CAN read files as just a group of BYTES, but I assume you didn't mean that.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.