CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Posts
    34

    Object Collection?

    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

  2. #2
    Join Date
    Oct 2002
    Location
    Växjö, Sweden
    Posts
    225
    Well.... I guess your code just did it.... as the controls added to the form is the objects of your form.

    /Leyan
    Last edited by Athley; January 9th, 2003 at 10:55 AM.

  3. #3
    Join Date
    Nov 2002
    Posts
    34
    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....

    Code:
        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

  4. #4
    Join Date
    Nov 2002
    Posts
    34
    dont worry got it sorted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured