Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials 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 July 16th, 2009, 06:39 PM
Authorized User
 
Join Date: Jun 2008
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
Default Whats wrong with my FileSystemWatcher

I have code written that is supposed to watch a folder on my harddrive and when it sees that a new file has been created it is supposed to, for simplicity, pop up a message box and say it found it. The problem is that it runs through the routine (TDlogchange) that is supposed to be called when the file is found, several times instead of just once.

My understanding of the code was that it should only do it once when it sees a new file created. Below is the code. Any help would be great.

Dim TDFPath AsString = "C:\Data\KOHIN\"
PublicWithEvents TDwatchfolder AsNewFileSystemWatcher(TDFPath, "*.txt")


PrivateSub SetupNextEtchTankD()
TDwatchfolder.Path = TDFPath
TDwatchfolder.NotifyFilter = NotifyFilters.FileName
TDwatchfolder.EnableRaisingEvents = True

EndSub

PrivateSub TDlogchange(ByVal source AsObject, ByVal e As System.IO.FileSystemEventArgs) Handles TDwatchfolder.Created

MsgBox("Found the File!!!", MsgBoxStyle.OkOnly, "Tank D")

EndSub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Whats wrong? Agentofnight Beginning PHP 3 April 17th, 2005 04:11 AM
Whats wrong with the GUI display Sandz Java GUI 1 February 5th, 2005 08:28 AM
whats wrong with this code? sand133 VB.NET 2002/2003 Basics 2 September 12th, 2004 10:07 PM
Whats wrong with this code? Thomas82 Classic ASP Databases 6 February 26th, 2004 09:40 AM
whats wrong with this code ? qwprince Classic ASP Basics 5 July 27th, 2003 07:46 PM





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