Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

error in VB6 with filelistbox

Posted on 2012-03-21
4
Medium Priority
?
405 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
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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
Web hosting control panels were first developed to make it faster and easier for most users to set up and operate websites. The graphical user interface (GUI) allows users to perform tasks by pointing and clicking rather than typing highly specific…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

972 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