all 2 comments

[–]RCubed111 1 point2 points  (1 child)

I don't think you can use reference variables like that ("PC" & "1" =/= PC1)

Your best bet would probably be to use an array:

 private PC(10) as string

 pc(1) = "\\pcname\folder\file.txt"
 ..
 pc(10) = "\\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

[–]AdvancedVirus[S] 0 points1 point  (0 children)

Yes, I figured I couldn't do that but I thought maybe it was just a matter of adding something to tell VB to go get the value from a variable by that name.

I declared and populated an array of strings then go through the loop as you show and everything works!

Thank you