|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SystemRootI'm trying to use SystemRoot or any other directory reference to open a
filestream, but instead I get an error saying that the directory the project is looking in is the path of the project's bin file with my path appended to it. Hard-coding the directory works perfectly. Can I use the directory references to open a filestream? If not, is there another way to do it? Thanks, Matt I'm not really sure what you're trying to do. It's always a good idea to
specify complete paths to all files that you use. The trick is in building the path correctly. If you're trying to get at a file in the directory of your .EXE, you can use something like this: Dim filepath As String filepath = Path.Combine(Application.StartupPath, "myfile.txt") There are, of course, various default paths, like the users profile path or the system directory, that you can use to start building other paths, like: filepath = Path.Combine(Environment.GetFolderPath(SpecialFolder.System, "myfile.txt") -- <i><b>RageInTheMachine9532</b></i><font size="-2"> "<i>...a pungent, ghastly, stinky piece of cheese!</i>" <b>-- The Roaming Gnome</b></font>Show quoteHide quote "Matt" wrote: > I'm trying to use SystemRoot or any other directory reference to open a > filestream, but instead I get an error saying that the directory the project > is looking in is the path of the project's bin file with my path appended to > it. Hard-coding the directory works perfectly. Can I use the directory > references to open a filestream? If not, is there another way to do it? > > Thanks, > Matt > > > Dave
Actually, the Path and Application commands were exactly what I was looking for. Thanks for your help! Matt Show quoteHide quote "Dave Kreskowiak" <DaveKreskow***@discussions.microsoft.com> wrote in message news:CF95E0EA-54AB-48D1-A450-1FD9EDA05E5C@microsoft.com... > I'm not really sure what you're trying to do. It's always a good idea to > specify complete paths to all files that you use. The trick is in > building > the path correctly. If you're trying to get at a file in the directory of > your .EXE, you can use something like this: > > Dim filepath As String > filepath = Path.Combine(Application.StartupPath, "myfile.txt") > > There are, of course, various default paths, like the users profile path > or > the system directory, that you can use to start building other paths, > like: > > filepath = Path.Combine(Environment.GetFolderPath(SpecialFolder.System, > "myfile.txt") > > -- > <i><b>RageInTheMachine9532</b></i><font size="-2"> > "<i>...a pungent, ghastly, stinky piece of cheese!</i>" <b>-- The Roaming > Gnome</b></font> > > > "Matt" wrote: > >> I'm trying to use SystemRoot or any other directory reference to open a >> filestream, but instead I get an error saying that the directory the >> project >> is looking in is the path of the project's bin file with my path appended >> to >> it. Hard-coding the directory works perfectly. Can I use the directory >> references to open a filestream? If not, is there another way to do it? >> >> Thanks, >> Matt >> >> >>
How to create a report (invoice)?
Q: deleting relations problem save and reading from the registry File operation with user-set wildcards Drag and Drop from Outlook to Vb.net RichTextBox Problems with SaveAs Using SQLDataSource without a control? Arrays please help me SFTP Where is the ENTIRE list of compile time error messages/numbers stored in vb/visual studi |
|||||||||||||||||||||||