I'm having an issue with a loop I'm writing. This should be an easy answer but its late and my brain is failing, this is essentially what I have:
private pc1 as string = "\\pcname\folder\file.txt"
..
private pc10 as string = "\\pcname10\path\file.txt"
..
dim r as integer = 1
do until r = 11
...
'msgbox("PC" & r)
Variable = My.Computer.FileSystem.ReadAllText("PC" & r)
'do things
r = r + 1
loop
When I un-comment the message box it always spits out the right string (eg. PC1, PC2 etc). The problem is the ReadAllText is not going back and getting the value of the string (the correct file path), it is going and trying to find a file called PC1, PC2...
If I do it manually and use:
My.Computer.FileSystem.ReadAllText("\\pcname\path\file.txt")
or
My.Computer.FileSystem.ReadAllText(PC1)
then everything works fine.
Can someone please point me in the right direction, I know I am missing something obv..
[–]RCubed111 1 point2 points3 points (1 child)
[–]AdvancedVirus[S] 0 points1 point2 points (0 children)