Visual Studio 2013 Lesson : Import TXT file
[Lesson 41] <<[Contents] >>[Lesson 43]
Import TXT file (alternate method)
Visual Studio features a command line that allows data to
be imported from various file types.
Streamreader reads the files and adds the data to
assigned objects, strings or arrays.
The coding shown imports a TXt (text file). Note the
data in the text file is separated to smaller strings
using the (,) comma.
The following coding imports a TXT file,assigns each
Dim fileReader
As
System.IO.StreamReader
fileReader =
My.Computer.FileSystem.OpenTextFileReader("C:\\testfile.txt")
Dim
stringReader As
String
stringReader = fileReader.ReadLine()
MsgBox("The first line of the
file is " & stringReader)