I have a Text file with several different C:\ locations i need, the idea is to use the streamreader to read the text file, load each line into an array and then be able to use that specific array per line in the Sub routines to code.

the idea, is that if in the future the location of the C:\ changes, there is no need to go into the code, just modify the information on that txt file and that would be it...

have tried several ways but no luck...

text file info looks like

d1="C:\displaydata\d1.html" d2="C:\displaydata\d2.html" d3="C:\displaydata\head.html" d4="C:\displaydata\nodata.html" d5="C:\readdata\d1.html"
an example of a routine is:

If My.Computer.FileSystem.FileExists(C:\displaydata\d1.html) = True Then My.Computer.FileSystem.MoveFile(C:\displaydata\d1.html, "C:\readdata\d1.html") End If
again, i do not want to use Dim d1 as string = "C:...." since the idea is to modify the txt file and that updates the new location in C:\

Reading all the lines into an array is easily accomplished with the File class, which is part of the IO namespace, and includes a ReadAllLines functions that returns a string array containing all lines in the file. From that point it's a relatively easy matter to iterate through the array and parse each line. The Path class, which is also included in the IO namespace, can parse a string to create a file path. This allows changing source directories or filename to create a new path.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.