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 :)
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 :)
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.
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....
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
Oops, correction:
VB Code:
'....... ReDim Preserve FileList(i) 'preserve all data in array '........ Private Sub List1_Click() Debug.Print FileList(List1.ListIndex) End Sub