Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
The following snippet demonstrates the use of the ...
E-mail:
Click to e-mail author
Website:
http://www.a1vbcode.com/
Submitted:
5/9/2000
Version:
VB5
Compatibility:
VB5, VB6
Category:
File Manipulation
Views:
10034
The following snippet demonstrates the use of the Dir$ function which returns the name of a file or folder matching the pattern passed to the function. All filenames matching the search pattern are displayed in a list box.
Declarations:
'none
Code:
'Place the following code in a command button's click event Private Sub cmdGetFilename_Click() Dim sFilename As String Dim sPath As String 'search for files with vbp extension sPath = "c:\yourpath\*.vbp" 'use Dir$ to get first matching filename sFilename = Dir$(sPath) 'retrieve remaining files matching the search pattern 'Dir$ returns zero length string when no match Do While sFilename > "" ListBox1.AddItem sFilename 'call Dir$ without parameters to get next filename sFilename = Dir$ Loop End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement