Click to See Complete Forum and Search --> : Object Collection?


ilk
January 9th, 2003, 09:27 AM
Hi

Is there a way to iterate through objects in a Form like through controls collection?

dim ctrl as control

for each ctrl in controls
debug.writeline(ctrl.gettype.tostring)
next


Thanks

Athley
January 9th, 2003, 09:33 AM
Well.... I guess your code just did it.... as the controls added to the form is the objects of your form.

/Leyan

ilk
January 9th, 2003, 09:57 AM
no it does not do it,

What i need to do is to be able to monitor the filesystem for changes in different directories. maybe i'm not doing it proper way but i need to have it done quickly....



Private Sub addWatcher(ByVal strPath As String, ByVal strFilter As String)
fsWatcher1 = New System.IO.FileSystemWatcher(strPath, strFilter)
Dim obj As Object

fsWatcher1.EnableRaisingEvents = True
'fsWatcher1.IncludeSubdirectories = True
AddHandler fsWatcher1.Changed, AddressOf fsEventHandler
Debug.WriteLine(fsWatcher1.GetType)
End Sub

Private Sub fsEventHandler(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)
MsgBox(e.FullPath)
End Sub


it creates a filesystemwatchers that work. but now i need to write a sub that will dispose of all watchers created with this sub

ilk
January 9th, 2003, 10:22 AM
dont worry got it sorted