473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem with FileSystemWatcher/Tray Notifier App

Hi,

I've been developing an application in VB.NET that uses the
FileSystemWatcher and a popup notification in order to tell me when files
have been downloaded.

The FileSystemWatcher code in my project is basically the same one thats
floating all over the VB.NET sites (by Jayesh Jain). The popup notification
(called TaskbarNotifier) is a class originally by John O'Byrne written in C#
and C++ but ported to VB.NET by Patrick Vanden Driessche. It was downloaded
from codeproject.com.

Both of these elements (FileSystemWatcher and TaskBarNotifier) work
perfectly on the own but I experienced problems when I tried incorporating
and combining them in my own project.

Basically, the FileSystemWatcher will detect files created, changed, deleted
etc and the TaskBarNotifier will display popups as it should. The problem
comes when I create a file (by means of downloading it or by just copying it
to the 'watched' folder directly). I've coded it so the TaskBarNotifier
should popup with name of the file created/downloaded then disappear after 3
seconds. It should, but doesn't. I can't understand why the same code will
not run when used under a different procedure.

I would of prefered to paste the code here in the hope people willing and
able to help can paste it directly into their own VB.NET environment but the
project contains bitmaps (as Embedded Resources) for the skins of the popups
and they need to be included when compiling/testing the app otherwise it
won't compile. So for this reason I've posted the project on my website for
download.

Homepage: http://www.geocities.com/toffee_paul/fun_d_mental.html
Direct Link: http://www.geocities.com/toffee_paul/vbnetproj.zip

When compiled and the form is displayed, click 'Test just the Popup' and the
popup will appear as it should. Now change the 'watch folder' to a valid
folder and copy a file to this folder. The app will detect the newly
created file (as proven in the 'content' textbox) but the popup will fail to
appear. Very strange problem.

Any help is very much appreciated,
Thanks
Paul
Jul 21 '05 #1
2 4794
"Paul" <pr*****@mail.com> schrieb:
The FileSystemWatcher code in my project is basically the same one thats
floating all over the VB.NET sites (by Jayesh Jain). The popup
notification (called TaskbarNotifier) is a class originally by John
O'Byrne written in C# and C++ but ported to VB.NET by Patrick Vanden
Driessche. It was downloaded from codeproject.com.

Both of these elements (FileSystemWatcher and TaskBarNotifier) work
perfectly on the own but I experienced problems when I tried incorporating
and combining them in my own project.


Make sure that the 'FileSystemWatcher''s 'SynchronizingObject' is set to
your form. Otherwise your event handlers are executed on a thread of the
thread pool and thus invoking will be required to access Windows Forms
elements running in the application's main UI thread.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #2
Brilliant, thanks Herfried!

I added the following line to the Load event of my form....

WatchFolder.SynchronizingObject = Me

And all works perfectly now.
Thanks again.
Paul

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
"Paul" <pr*****@mail.com> schrieb:
The FileSystemWatcher code in my project is basically the same one thats
floating all over the VB.NET sites (by Jayesh Jain). The popup
notification (called TaskbarNotifier) is a class originally by John
O'Byrne written in C# and C++ but ported to VB.NET by Patrick Vanden
Driessche. It was downloaded from codeproject.com.

Both of these elements (FileSystemWatcher and TaskBarNotifier) work
perfectly on the own but I experienced problems when I tried
incorporating and combining them in my own project.


Make sure that the 'FileSystemWatcher''s 'SynchronizingObject' is set to
your form. Otherwise your event handlers are executed on a thread of the
thread pool and thus invoking will be required to access Windows Forms
elements running in the application's main UI thread.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: cxw0106 | last post by:
Hello, I have some weird problem with the FileSystemWatcher. I have developed an application that monitors a network directory for file changes of a certain file type. The program runs well for...
1
by: balu | last post by:
Hello , I Had a problem in developing a application for getting a message over or above system tray . When we first logon into the yahoo messenger , whenever a new user logon ,The messenger...
9
by: Paul | last post by:
Hi, VB.NET is saying the file I am creating is in use by another process and won't complete its task of moving the file to the specified destination folder. Here is my code (the main bit...
10
by: Zeljko | last post by:
Hi, I have a form with a tray icon. However, when I minimize the form, it stays visible - not in the task bar (I have showintaskbar property set to false), but in a form of a rectangle sitting...
3
by: Stampede | last post by:
Hi, I write an application which waits for incomming files in a specified directory. I thought, that using the FileSystemWatcher would be the best, as it does exactly what I need. But now I have...
2
by: Paul | last post by:
Hi, I've been developing an application in VB.NET that uses the FileSystemWatcher and a popup notification in order to tell me when files have been downloaded. The FileSystemWatcher code in...
2
by: Jasper Jones | last post by:
I have a main form which has a list of items from a table on my database. If I click one of these items it brings up a second form which lets you edit the details for that item. If I change an...
0
by: Richard | last post by:
Some printers "tray id's" does not correspond to .NET framworks System.Drawing.Printing.PaperSourceKind enumerator, such as "hp color LaserJet 2550L". this is what the "tray id's" actually is ...
3
by: =?Utf-8?B?UnVkeQ==?= | last post by:
Hello All! I may have posted this problem before, but it was awhile ago. I'm working in VS 2003. I have 10 file watch process going. It seems that I can only about 6or 7 to run at the same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.