Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2007, 04:47 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple FileSystemWatcher trigger

Hi Guru on the board

Please pardon me if my question is stupid.

I had successfully created a program to track the activities for folder with using FileSystemWatcher in VB.net

Whenever a file had been created or remove from the designated FTP server folder. an Email will be generated to my account to notify me.

A fews of mates, would like me to track their file too. I could have used the easier way to plant the exe into that folder as well (we are sharing the same file server)

But i had a idea to use excel to keep track the setting file. hence when i trigger the program. I only need one exe to run at the background to cut down the resource for windows task.

The excel will be designed as

Folder Addressee Email
------ --------- -----
c:\ftpsvr\usera Lawrence [email protected]
c:\ftpsvr\userb Laura [email protected]
c:\ftpsvr\userc Laury [email protected]

so when i start the program. I will inform the filesystemwatcher to start as three different new object.

Dim FSWa as new filesytemwatcher
Dim FSWb as new filesytemwatcher
Dim FSWc as new filesytemwatcher

but that lead to another problem. what if i have another user need to do the similar action again. I will have to go back to the source code to declare another new FSWd to track the new folder? and it gonna be endless loop....

anyone could enlighten me please?

Thanks in advance

Lawrence
 
Old March 19th, 2007, 01:53 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Include code that invokes Add Handler functionality. The adding of a handler takes a text argument, and so can be repeatedly invoked with a string representing each watching task you need, and the number of strings can be dynamic, rather than hard-coded into the program.





Similar Threads
Thread Thread Starter Forum Replies Last Post
FileSystemWatcher brawny4 Visual Basic 2005 Basics 3 December 28th, 2006 12:47 PM
FileSystemWatcher? [C#] [email protected] General .NET 2 May 13th, 2005 03:50 AM
FileSystemWatcher Problem [email protected] VB.NET 0 December 18th, 2004 11:29 AM
FileSystemWatcher Class bwood415 General .NET 5 December 6th, 2004 04:55 AM
Trigger support for multiple Inserts kim3er SQL Server 2000 1 November 6th, 2004 02:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.