Monday, October 11, 2010

Visual Basic File System Function : Dir, Dir$

Purpose : The Dir and Dir$ function return a filename that matches the supplied pattern, file attribute or volume label of a drive . the Dir$ function is retained of backward compatibility.

Syntax :
For the first call to Dir

Dir [ ( pattern$ [ , Attributes ] ) ]

For each successive call for the same pattern :

Dir

Temp$ = Dir ( "*.DOC" )
Do Until Temp$ = ""
i=i+1
Docs ( i ) = Temp$
Temp$ = Dir
Loop
Temp$ = Dir ( "*.*" , vbHidden )
Temp$ = Dir ( "c:\ " , vbDirectory )

Constants used with the Dir function
Constant : Value : Description
vbNormal : 0 : Normal
vbHidden : 2 : Hidden
vbSystem : 4 : System file
vbVolume : 8 : Volume label;
vbDirectory : 16 : Directory

No comments:

Post a Comment