Visual Basic 2005 BasicsIf 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
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
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.