File List Box Problem on Network Drives 
Author Message
 File List Box Problem on Network Drives

Hi,
I have a standard file list box and in my code I do :-

FileList1.Path = source_dir
FileList1.Refresh
If FileList1.ListCount > 0 Then
' do xyz
End If

As expected this works fine on my local hard disk but if the files are
actually on a network drive then the ListCount returns zero even
though there is actually files in the directory when viewed with
Explorer.
This seems to me that it might be some sort of latency problem and the
refresh hasn't finished before going on to check the listcount value.
Is there some way of making the system wait until the refresh has
finished before going on to the next bit of code? That is without
doing any crappy work around code to wait x number of seconds etc
every time.
I tried the DoEvents function but got no joy from that.

regards
Ian Birbeck



Wed, 18 Jun 1902 08:00:00 GMT  
 File List Box Problem on Network Drives
Hi Ian,

did you set FileList1.Pattern = "*.*"   ???

Good luck,
Guido.



Quote:
>Hi,
>I have a standard file list box and in my code I do :-

>FileList1.Path = source_dir
>FileList1.Refresh
>If FileList1.ListCount > 0 Then
>' do xyz
>End If

>As expected this works fine on my local hard disk but if the files are
>actually on a network drive then the ListCount returns zero even
>though there is actually files in the directory when viewed with
>Explorer.
>This seems to me that it might be some sort of latency problem and the
>refresh hasn't finished before going on to check the listcount value.
>Is there some way of making the system wait until the refresh has
>finished before going on to the next bit of code? That is without
>doing any crappy work around code to wait x number of seconds etc
>every time.
>I tried the DoEvents function but got no joy from that.

>regards
>Ian Birbeck



Wed, 18 Jun 1902 08:00:00 GMT  
 File List Box Problem on Network Drives
Want to try doing the

' do xyz

... without using a control?  Check out the FindFirstFile methods in the
Code Library/FileAPI section at http://www.mvps.org/vbnet/

--

Randy Birch, MVP Visual Basic

http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/

Please correspond only using the newsgroups so all can benefit.


| Hi,
| I have a standard file list box and in my code I do :-
|
| FileList1.Path = source_dir
| FileList1.Refresh
| If FileList1.ListCount > 0 Then
| ' do xyz
| End If
|
| As expected this works fine on my local hard disk but if the files are
| actually on a network drive then the ListCount returns zero even
| though there is actually files in the directory when viewed with
| Explorer.
| This seems to me that it might be some sort of latency problem and the
| refresh hasn't finished before going on to check the listcount value.
| Is there some way of making the system wait until the refresh has
| finished before going on to the next bit of code? That is without
| doing any crappy work around code to wait x number of seconds etc
| every time.
| I tried the DoEvents function but got no joy from that.
|
|
| regards
| Ian Birbeck
|



Wed, 18 Jun 1902 08:00:00 GMT  
 File List Box Problem on Network Drives
Hi,
Yeah I've got "*.*" in the FileList1.Pattern and it works fine on my c
drive but when  trying to process files on a network drive.


Quote:

>Hi Ian,

>did you set FileList1.Pattern = "*.*"   ???

>Good luck,
>Guido.



Wed, 18 Jun 1902 08:00:00 GMT  
 File List Box Problem on Network Drives
Thanks I'll have a look at that but I can't see why the built in
control shouldn't work


Wed, 18 Jun 1902 08:00:00 GMT  
 File List Box Problem on Network Drives
Hi,
A recap on my problem.
I have a standard file list box and in my code I do :-

FileList1.Path = source_dir
FileList1.Refresh
If FileList1.ListCount > 0 Then
' do xyz
End If

As expected this works fine on my local hard disk but if the files are
actually on a network drive then the ListCount returns zero and
nothing is displayed in the box even though there is actually files in
the directory when viewed with Explorer.

At first I thought this was some kind of latency problem so I tried
using the DoEvents function but to no avail.

However I found that Mystring = Dir(source_dir, vbNormal) returned the
files from the directory so that proved it wasn't a latency problem.

So after a bit of investigation I found it's something to do with
length of string used to set FileList1.Path

For Example
if I use something like source_dir = "t:\abc\def\ghi\jkl"  then
everything is fine
but if I use source_dir = "t:\myproject_1\project_data" then the file
list box doesn't see the directory contents.

I'll have to suss out what the actual limits are but why does this
only affect network drives , has anyone ever seen this
before?????????????????????????

regards
Ian Birbeck



Wed, 18 Jun 1902 08:00:00 GMT  
 File List Box Problem on Network Drives

http://support.microsoft.com/support/kb/articles/Q196/1/41.asp
PRB: Problems Using Intrinsic File System Controls

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.

  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.

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. file list box problem across network drives

2. VB6 - file list box / drive box question - resolving network paths and computer names

3. Network drives in a drive list box control

4. Network Neighborhood in Drive List Box ??

5. Network Neighborhood in Drive List Box?

6. Reading Drive Settings (BIOS or Drive List Box)

7. Where are File, Drive, and Directory list boxes?

8. Drive/Dir/File List Box Question

9. Automation: Problem Accessing Files From Network Drive

10. problem w/ Open For Binary for file on read-only Network drive

11. problem w/ Open For Binary for file on read-only Network drive

12. Problems Deleting Files on Remote Network Drive

 

 
Powered by phpBB® Forum Software