Link to home
Start Free TrialLog in
Avatar of chuyan
chuyan

asked on

getting path

Hi all,
I would like to know, is there any function just like "GETDIR()" in Visual Fox Pro, which let users to choose path and return the path as a string?

Thanks!
Avatar of wnchan
wnchan

Yes, there ia a function for user to choose path and return the path as string. the function is Dir().
Avatar of Guy Hengel [angelIII / a3]
dear wnchan: Dir() doesn't allow the user CHOOSE a path, but return the current path

I think what chuyan needs is a dialog box to Open/Save a File.
In this case, you can use the Common Dialog Control (look in components)

Hope this helps
Avatar of chuyan

ASKER

yup, I think angelIII knows what  I need.  But I'm not sure that if common dialog box works.  Since I only want to let users to choose the directories only, I don't  want to let them input anything by typing.  I just want them to select their desired directory.  Could the common dialog box help?
In this case, not really.
You would need to implement your own dialog box using the drive control and the directory control and some buttons;
or try to find a free dialog box on sites like www.vbcontrol.com or www.vbaccelerator.com
Hope this helps
use the dirlistbox control that is in your toolbox, to see how it works stick a dirlistbox on your form and a textbox and paste this code:

Private Sub Dir1_Change()
    Text1.Text = Dir1.Path
End Sub

To try this example you need to add a textbox , commondialog control and a command button.
add this code in the form and run

Private Sub Command1_Click()
CommonDialog1.ShowOpen
Text1 = CommonDialog1.FileName
End Sub

text1 will contain the path of the file which the user has chosen by clicking the command button.
Hope this will help you.
bye.
ASKER CERTIFIED SOLUTION
Avatar of swoosh72
swoosh72

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
swoosh welcome to EE. it is customary to just post comments here.  the questioner can accept a comment as an answer at any time.
Thanks dude. I'm new here and I appreciate the tip.