|
-
Mar 7th, 2014, 12:08 AM
#1
Thread Starter
PowerPoster
[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
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Mar 7th, 2014, 12:41 AM
#2
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
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Mar 7th, 2014, 01:12 AM
#3
Thread Starter
PowerPoster
Re: Show only part of a filename in a label vb6
 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
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Mar 7th, 2014, 01:14 AM
#4
Thread Starter
PowerPoster
Re: Show only part of a filename in a label vb6
 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.
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
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
|