Here is a pice of the code
Private m_WatchDirector y As String
Private WithEvents m_FileSystemWat cher As FileSystemWatch er
Dim log As New Log
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
lstFiles.Items. Add(Now.ToStrin g() & " Starting")
readReg()
log.lstFiles.It ems.Add(Now.ToS tring() & " Init " & LookPath)
log.lstFiles.It ems.Add(Now.ToS tring() & " Init " & ToPath)
' Get the path to the directory we will watch.
m_WatchDirector y = LookPath 'Application.St artupPath
' m_WatchDirector y = m_WatchDirector y.Substring(0,
m_WatchDirector y.LastIndexOf(" \"))
'm_WatchDirecto ry &= LookPath '"\Files"
' Make the FileSystemWatch er.
m_FileSystemWat cher = New FileSystemWatch er(m_WatchDirec tory, "*.*") '
"*.txt")
m_FileSystemWat cher.NotifyFilt er = 0
m_FileSystemWat cher.NotifyFilt er = m_FileSystemWat cher.NotifyFilt er Or
NotifyFilters.F ileName
m_FileSystemWat cher.EnableRais ingEvents = True
m_FileSystemWat cher.IncludeSub directories = alldirs
' Process any files that already exist.
MsgBox(m_WatchD irectory)
ProcessExisting Files(m_WatchDi rectory)
End Sub
Private Sub ProcessExisting Files(ByVal directory_name As String)
Dim dir_info As New DirectoryInfo(d irectory_name)
Dim file_infos As FileInfo() = dir_info.GetFil es()
For Each fi As FileInfo In file_infos
ProcessFile(fi. FullName, fi.Name)
Next fi
End Sub
Private Sub ProcessFile(ByV al file_name As String, ByVal shName As String)
log.lstFiles.It ems.Add(Now.ToS tring() & " Processed " & file_name)
If shName = "\Thumbs.db " Then ' = LCase(file_name ) Then
Exit Sub
End If
MsgBox(file_nam e & " " & ToPath & "\" & shName)
FileCopy(file_n ame, ToPath & "\" & shName)
Kill(file_name)
End Sub
I also have the following in a module file
Public LookPath, ToPath As String
Public AllDirs As Boolean
Petter L.
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uR******** ******@TK2MSFTN GP15.phx.gbl...
Petter,
A nullreference is almost forever a non instanced object.
However the rest probably nobody can see without a little piece of code.
I hope this starts helps?
Cor