Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18013
Number of posts: 55386

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
open file in the same directory as the application Posted by tuli on 9 Jan 2009 at 8:51 AM
I am in VB6 development environment working on a project.
The project needs to open a 'setup.ini" file, whose location is supposed to be in the same directory as the (future) executable.
When the executable runs, if no location directory is mentioned, the application will first look for the "setup.ini" file in the same directory where the application is.
In the VB6 development environment, it seems that at RUN time, VB looks somewhere else and it cannot find it. I think it looks into the last directory when it looked before (previous location kept in the memory?).
Is there any way that I can open the file without having to mention a directory (because that directory will not be valid with the executable, which can be in ANY directory).

In short, I would like to be able to say <<Open “setup.ini” for input as 1>>, and VB will look into the directory where the project files are.
Please advise

Thank you
Report
Re: open file in the same directory as the application Posted by shasur on 10 Jan 2009 at 3:47 AM
You can try prefixing with App.Path like

Open App.Path & “\setup.ini” for input as 1

Cheers
Shasur
VBA Tips & Tricks (http://vbadud.blogspot.com)

C# Code Snippets (http:dotnetdud.blogspot.com)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.