VB .NET

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Thanks but it doesn't match.

FileInfo and DirectoryInfo aren't exist in VB .NET. I
can't declare a variable with these words.
 
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.
 
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
 
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
 
Back
Top