W William Ryan Dec 5, 2003 #2 Dim d As New DirectoryInfo("C:\") ' Where C:\ is the directory you are trying to enumerate Dim f As FileInfo For Each f In d.GetFiles Debug.WriteLine(f.ToString) Next
Dim d As New DirectoryInfo("C:\") ' Where C:\ is the directory you are trying to enumerate Dim f As FileInfo For Each f In d.GetFiles Debug.WriteLine(f.ToString) Next
G Guest Dec 5, 2003 #3 Thanks but it doesn't match. FileInfo and DirectoryInfo aren't exist in VB .NET. I can't declare a variable with these words.
Thanks but it doesn't match. FileInfo and DirectoryInfo aren't exist in VB .NET. I can't declare a variable with these words.
A Ayende Rahien Dec 5, 2003 #4 Import them. Thanks but it doesn't match. FileInfo and DirectoryInfo aren't exist in VB .NET. I can't declare a variable with these words. Click to expand...
Import them. Thanks but it doesn't match. FileInfo and DirectoryInfo aren't exist in VB .NET. I can't declare a variable with these words. Click to expand...
C Codemonkey Dec 5, 2003 #5 You have to import the System.IO Namespace *or* declare them using the full namespace path. Eg. To Import ----------- Add the following line to the top of your file: Imports System.IO This will allow you to use the following code: Dim d As New DirectoryInfo("C:\") Dim f As FileInfo For Each f In d.GetFiles Debug.WriteLine(f.ToString) Next To Declare using full namespace: -------------------------------- Dim d As New System.IO.DirectoryInfo("C:\") Dim f As System.IO.FileInfo For Each f In d.GetFiles Debug.WriteLine(f.ToString) Next Hope this helps, Trev.
You have to import the System.IO Namespace *or* declare them using the full namespace path. Eg. To Import ----------- Add the following line to the top of your file: Imports System.IO This will allow you to use the following code: Dim d As New DirectoryInfo("C:\") Dim f As FileInfo For Each f In d.GetFiles Debug.WriteLine(f.ToString) Next To Declare using full namespace: -------------------------------- Dim d As New System.IO.DirectoryInfo("C:\") Dim f As System.IO.FileInfo For Each f In d.GetFiles Debug.WriteLine(f.ToString) Next Hope this helps, Trev.
G Guest Dec 5, 2003 #6 How you do it ? In VB .NET, you have the "Inherits" word to import new class but you can't have more than ONE inherits ! In fact, we want just enter the path of a files and launch it. Thanks
How you do it ? In VB .NET, you have the "Inherits" word to import new class but you can't have more than ONE inherits ! In fact, we want just enter the path of a files and launch it. Thanks
W William Ryan Dec 5, 2003 #8 All of the core classes exist in both languages. Use Imports System.IO Remember, both languages break down to IL and the only real difference between them is syntax, not base classes
All of the core classes exist in both languages. Use Imports System.IO Remember, both languages break down to IL and the only real difference between them is syntax, not base classes