Solved

error in VB6 with filelistbox

Posted on 2012-03-21
4
393 Views
Last Modified: 2012-03-22
I use as follows
 With filvrije
   .Path = "J:\labels\"
   .Pattern = "*.xls"
 End With

But this will also show xlsx files
0
Comment
Question by:BIAPRO
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Paul-B
Comment Utility
What happens if you put a space between the last S and the quotes. like "*.xls "?
0
 

Author Comment

by:BIAPRO
Comment Utility
still shows
0
 
LVL 4

Accepted Solution

by:
Paul-B earned 500 total points
Comment Utility
I think you will need to copy the files to regular listbox then and screen them yourself. Something like...

Option Explicit

Private Sub Command1_Click()
  Call FillFileList("C:\")
End Sub


Private Sub FillFileList(byval sFolder as string)
   Dim sFilename as string
   list1.clear  '<--- added this in case you call the sub more than once.
   if Right (sFolder,1) <> "\" then sFolder = sFolder & "\"
   sFilename = Dir$(sFolder & *.xls")
   do until sFilename = ""
      if Right(sFilename,4) <> "xlsx" then
      	list1.additem clipExt(sFilename)
      End If
      sFilename = Dir$
   loop
End Sub

Private Function ClipExt(byval fname as string) as string
  Dim nPos as string
  nPos = InStrRev(fname,".")
  if nPos > 0 then
    fname = mid(fname,1,nPos-1)
  end if
  ClipExt = fname
End function

Open in new window

0
 

Author Closing Comment

by:BIAPRO
Comment Utility
thanks, that will do
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
Let’s list some of the technologies that enable smooth teleworking. 
This video shows how use content aware, what it’s used for, and when to use it over other tools.
The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now