|
-
Jul 27th, 2000, 03:10 AM
#1
Thread Starter
Member
-
Jul 27th, 2000, 03:23 AM
#2
Well ....
(B2FTom), let me confess I don't know a direct solution to your problem, i.e. I don't know how to extract only a path from the common dialog control. But again, why bother?
Once you get the path and the filename, just chop off the filename part and you get the path. To locate the filename, you can search the string for '/'.
-
Jul 27th, 2000, 03:36 AM
#3
Thread Starter
Member
Why not ?
I didn't think of this solution. But to know if it's possible, i let my post active.
However, thanks for your solution, i'll keep it.
-
Jul 27th, 2000, 03:38 AM
#4
Fanatic Member
why not make a little function to do it
function getPath() as string
Dim strfilename As String
Dim tempchar As String
Dim lengthoffile As Integer
Dim i As Integer
Dim path As String
strfilename = CommonDialog.FileName
lengthoffile = Len(strfilename)
For i = lengthoffile To 0 Step -1
tempchar = Mid(strfilename, i, 1)
If tempchar = "\" Then
path = Mid(strfilename, 1, i)
Exit For
End If
Next
getpath = path
End Function
Hope this helps Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jul 27th, 2000, 04:27 AM
#5
Thread Starter
Member
Ianpbaker, i've already made code which does what i wanted (based on honeybee idea).
But i'm courious and i want to know (if somebody know) how to make it with properties or methods, like i tried the first time. Thanks. 
I looked your code and i saw it was a little bigger. I give you what i did, which is smaller, if someday you would like to do it :
Code:
FilePath = CommonDialog.FileName
Do While Mid(FilePath, Len(FilePath), 1) <> "\"
FilePath = Left(FilePath, Len(FilePath) - 1)
Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|