M
Mike Quernemoen
Hello,
I've got an application which creates a filesystemwatcher for each record in
a datatable as shown in attached code. I'm wondering how I would get list
of these dynamically created objects from a different function.
Thanks,
Mike
This is my how I create a filesystemwatcher for each record.
Dim fsw As FileSystemWatcher
For Each dr In dt.Rows
If dr("INVALID") <> True Then
fsw = createfsw(dr.Item("repdir"), dr("INCLUDESUBDIRS"))
End If
Next
Private Function createfsw(ByVal repdir As String, Optional ByVal
INCLUDESUBS As Boolean = False) As FileSystemWatcher
Dim fsw As New FileSystemWatcher()
fsw.Path = repdir
fsw.EnableRaisingEvents = True
fsw.IncludeSubdirectories = INCLUDESUBS
fsw.SynchronizingObject = Me
AddHandler fsw.Created, AddressOf FSW_Created
AddHandler fsw.Changed, AddressOf FSW_Created
AddHandler fsw.Deleted, AddressOf FSW_Deleted
AddHandler fsw.Renamed, AddressOf FSW_Renamed
Return fsw
End Function
I've got an application which creates a filesystemwatcher for each record in
a datatable as shown in attached code. I'm wondering how I would get list
of these dynamically created objects from a different function.
Thanks,
Mike
This is my how I create a filesystemwatcher for each record.
Dim fsw As FileSystemWatcher
For Each dr In dt.Rows
If dr("INVALID") <> True Then
fsw = createfsw(dr.Item("repdir"), dr("INCLUDESUBDIRS"))
End If
Next
Private Function createfsw(ByVal repdir As String, Optional ByVal
INCLUDESUBS As Boolean = False) As FileSystemWatcher
Dim fsw As New FileSystemWatcher()
fsw.Path = repdir
fsw.EnableRaisingEvents = True
fsw.IncludeSubdirectories = INCLUDESUBS
fsw.SynchronizingObject = Me
AddHandler fsw.Created, AddressOf FSW_Created
AddHandler fsw.Changed, AddressOf FSW_Created
AddHandler fsw.Deleted, AddressOf FSW_Deleted
AddHandler fsw.Renamed, AddressOf FSW_Renamed
Return fsw
End Function