Results 1 to 3 of 3

Thread: CommonDialog....... Getting a Path from ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    84
    I've used the CommonDialog to get a path to a file.

    It's working and I get back a path like:

    "C:\test\test1\test.txt"

    From the the ".FileName"

    I only need the path though..... umm, I guess I was wondering the best way to get it to work.


    I'm really just trying to get a path to an application from the user. I have the application name as the only filter selected - so the user has to either cancel or find the right file (so I know the path is valid).


  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    looks like you have to roll your own
    by removing chars back to the slash

    Code:
    Private Sub Form_Activate()
        Dim p$, j%
        CommonDialog1.ShowOpen
        p = CommonDialog1.filename
        For j = Len(p) To 5 Step -1
            If Mid$(p, j, 1) = "\" Then Exit For
        Next
        Text1 = Left$(p, j - 1)
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    84
    Thanks!

    I actually found the LEN command on my own - and was scratching my head wondering what to do with the returned lenght value.

    - I could have never come up with that loop on my own though! THANKS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width