Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo
How to use GetFiles (Saturday, August 28, 2004)
 

Found the following interesting discussion in the Newsgroups:

How to use GetFiles
by:yxq

Hi,
I only can get one file type using GetFiles function,

GetFiles(path, "*.txt")

But if i want to get two or more file types, how to do?

Thanks


 Reply:
by:yEaH rIgHt

 
Dim str() as String

str = GetFiles(path, "*.*")

For i = 0 to str.Length -1

If Path.GetExtension(str(i)) = ".txt" or Path.GetExtension(str(i)) = ".doc" then
'--- Do whatever
End if

Next


 Reply:
by:Phill. W

 

Imports System.IO
.. . .
For Each eFile As String In Directory.GetFiles(path, "*.*")
Select Case Path.GetExtension(eFile).ToLower()
Case ".doc", ".txt"
' Do Something
End Select
Next

HTH,
Phill W.


 Reply:
by:yxq

 Thank you



Posted by Xander Zelders



 
Previous Posts
    - Custom treeview question
    - Error Using Webbrowser Control on Form
    - Regular Expressions
    - forms Control collections
    - Jump Menu (DropDown Menu) in ASP.net.
    - Shutdown / Restart
    - Printing in .NET
    - VB.Net Output
    - How to load an object's property which is an array...
    - System.Diagnostics.Debug

Archives
    - 08/01/2004 - 08/08/2004
    - 08/08/2004 - 08/15/2004
    - 08/15/2004 - 08/22/2004
    - 08/22/2004 - 08/29/2004
    - 08/29/2004 - 09/05/2004
    - 09/05/2004 - 09/12/2004
    - 09/12/2004 - 09/19/2004
    - 09/19/2004 - 09/26/2004
    - 09/26/2004 - 10/03/2004
    - 10/03/2004 - 10/10/2004
    - 01/02/2005 - 01/09/2005
    - 01/09/2005 - 01/16/2005
    - 01/30/2005 - 02/06/2005
    - 01/01/2006 - 01/08/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland