Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Code for selecting current directory

Status
Not open for further replies.

ironmunk

Technical User
Aug 21, 2001
51
CA
I have hard coded my path of some images I need. What is the command so VB just looks in the current directory?
 
Have you used DriveListBox, DirListBox and FileListBox
controls? It will greatly make your coding easier if you
use those 3.

torturedmind [trooper]
 
I can't use list boxes. I don't want the user to select the file, I have the paths hard coded (below)..

pic1.picture = loadpicture ("c:\test\test.jpg)

I don't want to specify c:\test, I just want current directory
 
then you have no prob at all. by coding

pic1.picture = loadpicture("test.jpg")

your app will just search the file "TEST.JPG" in the
current directory.

hope this helps.

torturedmind [trooper]
 
from MSDN:

CurDir Function


Returns a Variant (String) representing the current path.

Syntax

CurDir[(drive)]

The optional drive argument is a string expression that specifies an existing drive. If no drive is specified or if drive is a zero-length string (""), CurDir returns the path for the current drive.


Path
This property returns and sets the current path.

Syntax
object.Path [= pathname]

Parameters
object
Object expression that evaluates to an App object.
pathname
String expression that evaluates to a path name.
Remarks
The Path property is unavailable at design time. For the App object, the Path property is read-only at run time.

The value of Path is a string that indicates a path.


App Object


The App object is a global object accessed with the App keyword. It determines or specifies information about the application's title, version information, the path and name of its executable file and Help files, and whether or not a previous instance of the application is running.

Syntax

App
 
Just to add... You could also try..

App.path.. returns the current path of the executed file..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top