|
-
Oct 30th, 2002, 01:03 PM
#1
Thread Starter
Frenzied Member
Easiest Way to remove the File Extension From The FileList Box?
Hey ya,
Currently:
FileList.FileName is showing as:
MyFile.sve
How can i make it show as:
MyFile
But, the FileName Value remain as:
MyFile.sve?
Tnx
-
Oct 30th, 2002, 01:53 PM
#2
PowerPoster
check the object browser and see if there's a property that lets you configure the file name display to show up without extent.
You could always hide the file box and transfer all the names over to a regular list box minus the extent --- that's a little baggy, but it will get the job done.
-
Oct 30th, 2002, 04:22 PM
#3
Addicted Member
Perhaps...just a thought....
Why not synchronize a List Box with the File List box. Make the File List Box hidden.
VB Code:
Dim sFName as string
Dim lPos as long
Dim i as long
FileList1.path = "C:\My Documents"
List1.Clear
For i = 0 To FileList1.Listcount - 1
lPos = InstrRev(FileList1.List(i),".")
If lPos <> 0 then
sFName = Left(FileList1.List(i), LPos-1)
Else
sFName = FileList1.List(i)
End If
List1.Additem sFName
Next i
....just a suggestion....
Some days you're the dog,
and some days you're the hydrant.
VB6 Enterprise
-
Oct 30th, 2002, 04:59 PM
#4
PowerPoster
Here is another approach: similar but no FileListbox at all:
VB Code:
Option Explicit
Dim FileList() As String
Private Sub Dir1_Change()
'=========================
Dim i%, pos%, MyPath$, FileName$
MyPath = Dir1.Path
FileName = Dir(MyPath, vbNormal)
Do While FileName <> ""
If FileName <> "." And FileName <> ".." Then
If (GetAttr(MyPath & FileName) And vbNormal) = vbNormal Then
ReDim FileList(i)
FileList(i) = FileName
pos = InStrRev(FileName, ".")
List1.AddItem Left(FileName, pos - 1)
i = i + 1
End If
End If
FileName = Dir
Loop
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
-
Oct 30th, 2002, 05:11 PM
#5
PowerPoster
Oops, correction:
VB Code:
'.......
ReDim Preserve FileList(i) 'preserve all data in array
'........
Private Sub List1_Click()
Debug.Print FileList(List1.ListIndex)
End Sub
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
|