ReadAllText will not accept string variable

  • Thread starter Thread starter Mike Kipling
  • Start date Start date
M

Mike Kipling

Guest
I am using the function ReadAllText to read a text file. It works fine if I pass it a string like this:

Dim AllText As String = ""

AllText = My.Computer.FileSystem.ReadAllText("C:\file.txt")


However, I get an unhandled exception when I try to pass it a string variable instead of a literal string like this.

Dim AllText As String = ""
Dim strng As String

strng = "C:\file.txt"

AllText = My.Computer.FileSystem.ReadAllText(strng)


Any suggestions?

Thanks,

Mike

Continue reading...
 
Back
Top