View Single Post
Old 04-01-2015, 01:16 PM
BigHairy BigHairy is offline
Join Date: Feb 2015
Posts: 4
Default System can't find a .txt file location when compiled

Hi All,
I'm very new to VB and programming in general. I am writing a program that read parameters from a txt file, allows user to edit them and then rewrites the txt file. The txt file needs to exist in the executable directory so that it can be edited outside of the program, if necessary. When I install the compiled program I keep getting the following error:

"System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\JVINSON\AppData\Local\Apps\2.0\W2BKQPZZ.8Z4\H98Q0DNN.LY6\sci n..tion_a25ae97b7d90e261_0001.0000_9802acfcf808e9a7\OCECPAR\SCInstrume ntParameter.txt'."

Here is what I think is the only relevant part of the program code. In case it's relevant, the directory I in which I am compiling the executable is: "C:\RT-Dummy"
Dim fullpath As String = System.Reflection.Assembly.GetExecutingAssembly().Location

Dim ThisDir As String = My.Computer.FileSystem.GetParentPath(fullpath)

Dim FilePath As String = ThisDir & "\OCECPAR\SCInstrumentParameter.txt"

Dim ReadParFile As New StreamReader(FilePath)

word = ReadParFile.ReadLine().Split("'")(0)
labelHe1B3Current.Text = (GetParameters(word)(0))
labelHe1B2Current.Text = (GetParameters(word)(1))
labelHe1B1Current.Text = (GetParameters(word)(2))
labelHe1ACurrent.Text = (GetParameters(word)(3))
textHe1B3New.Text = ""
textHe1B2New.Text = ""
textHe1B1New.Text = ""
textHe1ANew.Text = ""


Last edited by BigHairy; 04-01-2015 at 01:34 PM.
Reply With Quote