Solved

error in VB6 with filelistbox

Posted on 2012-03-21
4
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

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

Author Comment

by:BIAPRO
ID: 37748559
still shows
0
 
LVL 4

Accepted Solution

by:
Paul-B earned 500 total points
ID: 37749432
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
ID: 37751187
thanks, that will do
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
If your app took Google’s lash recently, here are the 5 most likely reasons.
The viewer will learn how to set up a document for the web and print and the recommended PPI for printing.
Viewers will learn how to use the Hootsuite Dashboard.

726 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