Why two messageBoxes?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Rudy said:
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.
 
Thanks Vincent!

Vincent said:
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.
 
Back
Top