tehon3299 Posted March 12, 2003 Posted March 12, 2003 I am using this method to get all the files in a directory: Dim sFiles() As String = System.IO.Directory.GetFiles("C:\") How do I print out all of the names in sFiles? Thanks Quote Thanks, Tehon
*Gurus* divil Posted March 12, 2003 *Gurus* Posted March 12, 2003 By looping through the array. I'm sure there are examples of this in the help file. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
tehon3299 Posted March 12, 2003 Author Posted March 12, 2003 Can you give me an example? I've been looking but can't find an example. Quote Thanks, Tehon
*Gurus* divil Posted March 12, 2003 *Gurus* Posted March 12, 2003 Dim sFile As String For Each sFile In sFiles Debug.WriteLine(sFile) Next Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
tehon3299 Posted March 12, 2003 Author Posted March 12, 2003 If this is on an ASPX page, how can I make this print in the body of the page? Quote Thanks, Tehon
*Gurus* divil Posted March 12, 2003 *Gurus* Posted March 12, 2003 I would guess Response.Write. If this was an ASP.NET question it should have been posted in that forum. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
tehon3299 Posted March 12, 2003 Author Posted March 12, 2003 Directory Filenames I am using the following code to get the files in a directory. Dim sFiles() As String = System.IO.Directory.GetFiles("C:\Documents and Settings\matt\Desktop\Songs\", "*.mp3") Is there anyway to return JUST the filename and not the whole path? Thanks Quote Thanks, Tehon
*Gurus* divil Posted March 12, 2003 *Gurus* Posted March 12, 2003 For a string containing a full path, you can use System.IO.Path.GetFilename() to extract just that portion of it. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
tehon3299 Posted March 12, 2003 Author Posted March 12, 2003 That works great. Thanks! Quote Thanks, Tehon
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.