Solved

error in VB6 with filelistbox

Posted on 2012-03-21
4
400 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 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft  Partnership 1 88
What is the best cd/dvd burning software available? 8 82
Chrome: How to show the Bookmarks bar? 4 46
wireless name in LAN adapter 14 68
Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

808 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