Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 6th, 2006, 8:21 PM   #1
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 298
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
FileSystemWatcher has multiple paths

Hello all, long time no see. I have a question. I am making a program that uses a FileSystemWatcher. Problem is I need it to watch for than one path or drive. Say someone has two HDD', and they want to watch both of them for activty. How I do that? This is what I got thus far, and it aint working.

Private Sub btnfolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfolder.Click
        watcher.Path = lstdrives.CheckedItems.ToString
    End Sub

What am I doing wrong? Please help.
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain

Destruction leads to a very rough road, but it also breeds creation.
bigguy is offline   Reply With Quote
Old Nov 6th, 2006, 8:50 PM   #2
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 852
Rep Power: 4 The Dark is on a distinguished road
I think you would have to make more than one watcher. It looks form the doco that a FileSystemWatcher can only watch one path (and subdirectories).
The Dark is offline   Reply With Quote
Old Nov 7th, 2006, 9:33 AM   #3
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 298
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
So like this?

Dim newwatch as New FileSystemWatcher
For Each drive in lstdrives.items
newwatch
Next

If so like that. How can I get it to assign each one a path, to make sure that two watchers don't have the same path?
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain

Destruction leads to a very rough road, but it also breeds creation.
bigguy is offline   Reply With Quote
Old Nov 7th, 2006, 10:01 AM   #4
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 852
Rep Power: 4 The Dark is on a distinguished road
My VB is a bit rusty, but I think you would have to allocate an array (or some other sort of collection) of FileSystemWatcher objects. Then inside a loop, set the watcher[i].path to each item in the list.
The Dark is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
max multiple of 3 xenop Software Design and Algorithms 2 Nov 7th, 2006 12:28 AM
Multiple conditions in an #ifdef statement JawaKing00 C 8 Apr 26th, 2006 4:11 PM
multiple images Dark Flare Knight Java 8 Jun 15th, 2005 7:19 AM
Multiple server clients using sockets + Threads captainK Java 3 Mar 4th, 2005 10:10 AM
multiple definition of variables in include files carlgreen C++ 3 Feb 26th, 2005 7:02 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:51 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC