Prev: HelpProvider and HTML Help interaction
Next: DataGridViewComboBoxColumn change to automatically update DataGridView
From: Armin Zingler on 24 Jan 2010 07:19 Anthony Papillion schrieb: > Hello again everyone, > > I'm developing an application that depends on an external data file. I've > created a new folder within the project and then added the data file to it. > I called the folder resources. > > Now, I'm trying to create a StreamReader to use the file. This is the code > I'm using: > > Try > Dim reader as New > StreamReader("System.AppDomain.CurrentDomain.BaseDirectory() & > "resources\datafile.dat", true) > Catch ex As Exception > MsgBox("Could not open file") > End Try Show us the real code. :-) I count 3 quotation marks in the 1st line. Number must be even. In general, use Sytem.IO.Path.Combine to build pathes. No backslash twiddling anymore. However, I don't have an answer to why you get that path. Here, BaseDirectory returns the path of the directory containing the Exe file. Haven't use the property before; I've always extracted the path from Application.ExecutablePath. Maybe you can give it a try also. -- Armin
From: Anthony Papillion on 24 Jan 2010 23:39
Thanks for the answer everyone! Definitely fixed my problem. Anthony |