471,123 Members | 854 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Why two messageBoxes?

Hello all!
I'm running a fileWatch on a file. When the the file has a LastWrite, it
will prompt a message box. Only looking at that file, and no Sub Directories.

Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object,
ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed

MessageBox.Show("All Bets Are On", "Bets")
End Sub
I do have a Store Procedure changing the file, but it's just changing one
value on the file. The Message box always comes up twice. Why is this?

Thanks!

Rudy
Jul 31 '06 #1
2 1062

Rudy wrote:
Hello all!
I'm running a fileWatch on a file. When the the file has a LastWrite, it
will prompt a message box. Only looking at that file, and no Sub Directories.

Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object,
ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed

MessageBox.Show("All Bets Are On", "Bets")
End Sub
I do have a Store Procedure changing the file, but it's just changing one
value on the file. The Message box always comes up twice. Why is this?

Thanks!

Rudy
Because two different things are happening to the file. I'm not sure
exactly because I never used FileSystemWatcher, but its probably
something like:
File opened
File read to memory
Data changed in memory
(event raised here) original file deleted
(event raised here) new file written.

Or something like that. Anyway, try seeing what options are availabe in
the "e" variable. And check only for the event you care about.

Cheers,
Vincent.

Aug 1 '06 #2
Thanks Vincent!

"Vincent" wrote:
>
Rudy wrote:
Hello all!
I'm running a fileWatch on a file. When the the file has a LastWrite, it
will prompt a message box. Only looking at that file, and no Sub Directories.

Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object,
ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed

MessageBox.Show("All Bets Are On", "Bets")
End Sub
I do have a Store Procedure changing the file, but it's just changing one
value on the file. The Message box always comes up twice. Why is this?

Thanks!

Rudy
Because two different things are happening to the file. I'm not sure
exactly because I never used FileSystemWatcher, but its probably
something like:
File opened
File read to memory
Data changed in memory
(event raised here) original file deleted
(event raised here) new file written.

Or something like that. Anyway, try seeing what options are availabe in
the "e" variable. And check only for the event you care about.

Cheers,
Vincent.

Aug 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Tony | last post: by
reply views Thread by Boomessh | last post: by
reply views Thread by Robert W. | last post: by
reply views Thread by luna | last post: by
4 posts views Thread by Carlos | last post: by
3 posts views Thread by Tim Osborne | last post: by

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.