home *** CD-ROM | disk | FTP | other *** search
- '
- ' This example was copied directly from Visual Basic. It has not
- ' been changed or altered in any way
- '
-
- 'Dir$ Function Example
-
- Sub DirDemo ()
- NL$ = Chr$(13) + Chr$(10): TB$ = Chr$(9) ' Define newline, tab.
- Msg$ = "Enter a file specification."
- Filespec$ = InputBox$(Msg$) ' Get filename.
- Match$ = Dir$(Filespec$) ' Find first match.
- If Len(Match$) Then ' If match found.
- Do
- MatchNum% = MatchNum% + 1 ' Increment match count.
- Msg2$ = Msg2$ + NL$ + TB$ + Match$ ' Make a list.
- If Len(Msg2$) >= 180 Then ' Handle list too long
- Match$ = "And more - - -" ' for MsgBox.
- Msg2$ = Msg2$ + NL$ + TB$ + Match$
- Exit Do ' Quit Do Loop.
- End If
- Match$ = Dir$ ' Find next match.
-
- Loop Until Len(Match$) = 0 ' Continue.
- If MatchNum% > 1 Then ' More than one file.
- Msg1$ = "The files that match your file specification are:"
-
- Else ' One match only.
-
- Msg1$ = "The file that matches your file specification is:"
- End If
- Msg$ = Msg1$ + Msg2$ ' Put message together.
- Else
- Msg$ = "The file you specified could not be found."
- End If
-
- MsgBox Msg$ ' Display message.
-
- End Sub
-
-
- sub main
- call dirdemo
- end sub
-