Dear all,

I am trying to create a program which will read the files that exist in a directory, and then write in a text file the specific information (full file name, date created)

i have found several code in the site but i cant make it work, the machine i am running the code is XP and i am using VB2008.

The code i have found is the following:

Imports System.IO
Imports System.String


Public Class Class1

Dim di As New IO.DirectoryInfo("C:\temp")
Dim Directory1 As IO.FileInfo() = di.GetFiles()
Dim File As IO.FileInfo
For Each File In Directory1
My.Computer.FileSystem.WriteAllText("C:\Hello.txt", File.FullName & vbCrLf, True)
Next


End Class


DOes this code create a file Hello.txt with the information that i need???


when i run the code which i dont know if it is the correct one i get the following errors:
1. Sub main was not found in "Project Name"
2. Statement cannot appear outside of a method body (it is for the line which starts with "For Each.........")
3.Declaration expected (for the word "My.")
4. sntax error (for the word "Next"


Thanks in advance for your help,

Best Regards