Results 1 to 3 of 3

Thread: how can i use this code or any code to get the full path including the name?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2001
    Posts
    746

    how can i use this code or any code to get the full path including the name?

    im usin the below code to get the path for the file that is draged over a listbox.

    VB Code:
    1. Public Function GetPath(ByVal sFile As String, Optional ByVal Slash = False) As String
    2.     'True shows "\" at the end
    3.     'False doesn't
    4.     GetPath = IIf(Slash = False, Left$(sFile, InStrRev(sFile, "\") - 1), Left$(sFile, InStrRev(sFile, "\")))
    5. End Function

    so when i use it i get C:\WINDOWS\Desktop\
    but i wana get the full path. i.e. C:\WINDOWS\Desktop\filename.txt

    how could i do this?

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Where are you getting the string passed to sFile? The function above strips the path out of the full path name which means to get the full path just don't use that function.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3
    Matthew Gates
    Guest
    That is the code I gave you. Forget that code completely. Don't use it at all. Just set the OLEDropMode of the Listbox to 1-Manual and add this code to your form.


    VB Code:
    1. Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     MsgBox Data.Files(1)
    3. End Sub

    Not hard at all, simple little task, the answer was given in your other thread as well.

    I had misunderstood your question and wrote that code, I'm sorry, but it wasn't needed at all.

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