vb6 - VBA.FileSystem Dir -


in vb6 code m using vba.filesystem.dir file name directory path. returning empty string. please find below code

call getfile.showopen //getfile commondialog control of vb6  txtfile.text = getfile.filetitle //correct file name returned if dir(getfile.filename) == ""      // conditions come true..but ideally should not!!! 

but file resides in network location. can there permission issue? if yes, how see file in getfile.showopen dialog , dir() returns empty string?

any on wrong in above code

consider these points:

  1. afaik, double equal ( == ) not supported in vb6

  2. dir = (whatever) can return "" if whatever directory or hidden file

you trap name using if dir(whatever, vbdirectory or vbhidden or vbarchive or vbnormal)

but still have test each see was.

btw, it's better have variable receive dir , inspect that, rather inspecting dir itself.

dim stgt$ stgt = dir(whatever) 

also, btw, alternative chking each type to inspect filelen.

curiously, filelen not affected hidden/sys attribs, although err out if file not exist.

so, (and old hacking stuff handy code).

if declare variable filelen

dim lflen& 'and have error coding on error resume next  'and inspect target lflen = filelen(stgt)  if lflen > 0  ... things  (or if hacking) ... binary open 

because, if file no exist, directory return 0, if file = archive, hidden, sys return bytes.

hth

gary


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -