Results 1 to 2 of 2

Thread: [RESOLVED] remove filename in the path location

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] remove filename in the path location

    How I can remove the filename in the path location?

    I have textbox that show the path location.
    During runtime My textbox show the full path location like this
    c:\project\data\block\table.dbf.

    How to remove the filename so that my textbox only show me path location like this

    c:\project\data\block\

    any suggestion or idea?

  2. #2
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: remove filename in the path location

    Code:
    Option Explicit
    
    Private Sub Form_Load()
       MsgBox GetDirFromFile("E:\VideoPaper\Videos\Atomic Kitten - Whole Again.mpg")
       MsgBox GetPathFromFile("E:\VideoPaper\Videos\Atomic Kitten - Whole Again.mpg")
    End Sub
    
    Public Function GetDirFromFile(FileName As String) As String
    'Returns "E:\VideoPaper\Videos\".
       GetDirFromFile = Left(FileName, InStrRev(FileName, "\"))
    End Function
    
    Public Function GetPathFromFile(FileName As String) As String
    'Returns "Atomic Kitten - Whole Again.mpg".
       GetPathFromFile = Right(FileName, Len(FileName) - InStrRev(FileName, "\"))
    End Function

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