Wrox Programmer Forums
|
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 December 28th, 2006, 12:24 PM
Authorized User
 
Join Date: Dec 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to brawny4
Default FileSystemWatcher

I followed a couple of examples from the book and from the web. I setup a file watcher on my PC at work. The directory is a network drive (L:\) but it doesn't seem to work. If I change it to go to the "CurrentPath" then the filesystemwatcher works.

Does anyone know why this doesn't work....Code list below.

Imports System.IO

Public Class Form1

    Private WithEvents m_Filesystemwatcher As FileSystemWatcher


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        m_Filesystemwatcher = New FileSystemWatcher(L:\Shared2\)
        m_Filesystemwatcher.IncludeSubdirectories = True
        m_Filesystemwatcher.EnableRaisingEvents = True
    End Sub

    Private Sub m_filesystemwatcher_created(ByVal sender As Object, _
        ByVal e As System.IO.FileSystemEventArgs) Handles m_Filesystemwatcher.Created
        MessageBox.Show("test")
    End Sub
End Class

mfb
__________________
mfb
 
Old December 28th, 2006, 12:30 PM
Authorized User
 
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ef1196
Default

L:\Shared2\ needs to be enclosed in quotes:

m_Filesystemwatcher = New FileSystemWatcher("L:\Shared2\")

In addition, "L:\Shared2" needs to (obviously) exist or an exception will be thrown.




Best Regards,
Earl Francis
 
Old December 28th, 2006, 12:35 PM
Authorized User
 
Join Date: Dec 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to brawny4
Default

I enclose it in quotes and that doesn't change anything either.

mfb
 
Old December 28th, 2006, 12:47 PM
Authorized User
 
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ef1196
Default

By simply cutting/pasting your code into a new project it works fine for me on a network or local folder.

It could possibly be a rights issue (however with a folder named "Shared" it probably is not). If this is not the case, you will need to wait for other users (such as WoodyZ or BrianWren) to weigh in with their thoughts.



Best Regards,
Earl Francis





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the FileSystemWatcher Control Eyob_the_pro C# 0 January 4th, 2007 03:08 AM
FileSystemWatcher? [C#] [email protected] General .NET 2 May 13th, 2005 03:50 AM
HELP - FileSystemWatcher Problems [email protected] Pro VB.NET 2002/2003 0 January 10th, 2005 09:37 PM
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





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