ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

36-Reading Text Files

The My.Computer.FileSystem object has a method that allows you to read a text file and it is called the ReadAllText.  The encoding file can be specified if the file contains an encoding text such as ASCII or UTF-8.

 

You need to specify the encoding file , if you are reading from a file with an extended characters.

 

Example:

  1. <pre>Dim fReader As String
  2. fReader = My.Computer.FileSystem.ReadAllText("C:\testfile.txt")
  3. MsgBox(fReader)

Example of Encoding File:

  1. Dim fReader As String
  2. fReader = My.Computer.FileSystem.ReadAllText("C:\testfile.txt",
  3.    System.Text.Encoding.UTF32)
  4. MsgBox(fReader)
Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!