[RESOLVED] Show only part of a filename in a label vb6
How do i get the last part of a filename after the last backslash and leave off the extension ?
Typical file name:
C:\Documents and Settings\All Users.WINDOWS\Documents\Real20CardKeno\KingKeno\SavedKingKenoGames\10 spot top row bet 10 cents.cle
Example: What i need
lblFilename = "10 spot top row bet 10 cents"
this part could be any length
Re: Show only part of a filename in a label vb6
Code:
Public Function GetBaseName(ByRef Path As String) As String
Dim StartPos As Long, EndPos As Long
StartPos = InStrRev(Path, "\") + 1&
EndPos = InStrRev(Path, ".")
GetBaseName = Mid$(Path, StartPos, EndPos - StartPos)
End Function
Re: Show only part of a filename in a label vb6
Quote:
Originally Posted by
Bonnie West
Code:
Public Function GetBaseName(ByRef Path As String) As String
Dim StartPos As Long, EndPos As Long
StartPos = InStrRev(Path, "\") + 1&
EndPos = InStrRev(Path, ".")
GetBaseName = Mid$(Path, StartPos, EndPos - StartPos)
End Function
Just what i needed thanks
Re: Show only part of a filename in a label vb6
Quote:
Originally Posted by
Bonnie West
Code:
Public Function GetBaseName(ByRef Path As String) As String
Dim StartPos As Long, EndPos As Long
StartPos = InStrRev(Path, "\") + 1&
EndPos = InStrRev(Path, ".")
GetBaseName = Mid$(Path, StartPos, EndPos - StartPos)
End Function
You must spread some Reputation around before giving it to Bonnie West again.