We help IT Professionals succeed at work.

filelistbox.listcount = 0 when it should be > 0 (windows98 problem?)

TheDane
TheDane asked
on
I have an application written in VB6. As part of the application a filelistbox is utilised to list files in a listbox control.  The filelistbox is set with a path.

On one laptop (which differs in make from all working laptops and desktops: it is a FUJITS)the filelistbox control always returns no files when a path has been set eventhough there are files present.  The O/S is Windows98.(Some working desktops has also got Windows98)

Could anybody tell me why it is not being displayed.  I know that when files are hidden they will not show through a filelistbox control.  What file setting could be different to exclude the files from view through the filelistbox control?

Thank you in advance

TheDane
Comment
Watch Question

Commented:
Hello

This might sound a silly question, but are the files pointing to the same path.  The reason I asked is because the laptop might have a D drive instead of a C drive.

Commented:
For example is the app pointing to the path

c:\inhere\

when on the laptop it should be

d:\inhere\
Senior DBA
CERTIFIED EXPERT
Commented:
This, from the MS Knowledgebase, is the probable answer (IMO):

PRB: Problems Using Intrinsic File System Controls  ID: Q196141

----
The information in this article applies to:

  a. Microsoft Visual Basic Learning, Professional, and Enterprise Editions
for Windows, versions 5.0, 6.0

----

SYMPTOMS
When you are using the intrinsic Visual Basic file system controls (for example, DriveListBox, DirListBox, FileListBox), some or all of your files are not listed. This usually occurs when you are trying to access files on a network server, but can occur locally under some circumstances.

CAUSE
The following statement is copied from the Visual Basic 5.0 Programmer's Guide (page 67) and you can also find it in the File System Controls section of the Forms, Controls, and Menus topic in Books Online:

  Note: These controls are provided primarily for backward compatibility with applications created in earlier versions of Visual Basic. The common dialog control provides an easier method of working with file access.

  For more information on common dialog control, see "Miscellaneous Controls" later in this chapter.

These controls are old technology. They were not designed for, nor tested with, some of the new operating and network system software. Specifically, these controls rely on the existence of 8.3 file and directory names. Any set of circumstances that result in the unavailability of 8.3 names will cause problems. For example, you can disable the creation of 8.3 file or directory names on a Windows NT Server. If this happens, the intrinsic controls will only see those directories or files that have 8.3 names.

RESOLUTION
As stated in the Visual Basic 5.0 Programmer's Guide, the best resolution is to use the CommonDialog control. Not only is it more likely to work, it also makes your application's user interface consistent with other Windows
applications.

Even if you do not want to use the CommonDialog, it can help you determine the specific nature of the problem you are experiencing. To demonstrate this, try using the CommonDialog to access the directories or files that are causing the problem when you are using the intrinsic controls. If the CommonDialog can display these files, the problem is most likely the result of the limitations of the intrinsic controls. If the CommonDialog fails, the problem is most likely located in the computer or network file system configuration.

STATUS
This behavior is by design.
CERTIFIED EXPERT

Commented:
Hi!

Just in case your problem is not like what SirNick has mentioned (but it's most likely the case)...

Could you have set any attributes of the filelistbox (Archive, Hidden, System...) and/or the extention (which is also known as the 'pattern' property) to something else?

That's it!

glass cookie ; )

Author

Commented:
Unfortunately I think this is the answer.  I think it is VERY bad that a control that comes WITH VB6 does not work!!

I will try to implement the functionality via the dir() function as mentioned in article: Q196028

Explore More ContentExplore courses, solutions, and other research materials related to this topic.