Click here to Skip to main content
15,845,785 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Hide a listView column Pin
mr_123459-May-06 16:06
mr_123459-May-06 16:06 
GeneralRe: Hide a listView column Pin
mounirbraham10-May-06 0:51
mounirbraham10-May-06 0:51 
AnswerRe: Hide a listView column Pin
bony_baba10-May-06 2:19
bony_baba10-May-06 2:19 
GeneralRe: Hide a listView column Pin
mounirbraham10-May-06 4:43
mounirbraham10-May-06 4:43 
GeneralRe: Hide a listView column Pin
jcrussell10-May-06 19:45
jcrussell10-May-06 19:45 
QuestionWHERE IS the ListSubItems Icon property ?? Pin
mounirbraham9-May-06 14:52
mounirbraham9-May-06 14:52 
QuestionControlling FileSystemWatcher Pin
Wrongway43219-May-06 11:44
Wrongway43219-May-06 11:44 
AnswerRe: Controlling FileSystemWatcher Pin
DSAlbin21-May-06 8:41
DSAlbin21-May-06 8:41 
In my application, I watch a folder for any newly created files. If a file "pops" up in the directory, any data in that file gets parsed to a database automatically. Files "pop" up in the directory from other applications using StreamWriters.

I don't really understand the FileSystemWatcher class well, but I could get my code to "trigger" only once by simply adding handlers for only the .Changed event of the watcher (and not the .Created, .Deleted, .Renamed, etc events).

For my watcher (mw), I would set the .NotifyFilter property and enable events:

mw.NotifyFilter=NotifyFilters.Attributes Or NotifyFilters.LastWrite
mw.EnableRaisingEvents

and use only a single handler:
AddHandler mw.Changed, AddressOf FolderChanged

When files show up in the watched directory, the FolderChanged subroutine triggers only once, gets the newly added file, and parses the contents to a database.

This seems to work well if the files are created as Streams from other applications. It doesn't work though, if I manually drag/drop a file into the watched directory,..this seems to create two "changed" events which results in the FolderChanged subroutine being called twice resulting in two records being created in the db.

But then,..my app doesn't require manual drag/drops,..so for me, it does the job.

So, to make a long winded story short,..I could get the .change event of the watcher to trigger once when I used only a single handler in my particular app. Don't add any additional handlers. Probably obvious to most....so this may not help you.

I'm gonna watch this post as I too am interested in being able to better define what events in a directory can trigger the FileSystemWatcher object. I don't understand this bitwise "ORing" process doesn't seem to have enough options for fine-tuning events.

Good Luck Smile | :)

Dave
GeneralRe: Controlling FileSystemWatcher Pin
Wrongway432123-May-06 13:17
Wrongway432123-May-06 13:17 
GeneralRe: Controlling FileSystemWatcher Pin
DSAlbin23-May-06 14:17
DSAlbin23-May-06 14:17 
GeneralRe: Controlling FileSystemWatcher Pin
Wrongway432124-May-06 11:55
Wrongway432124-May-06 11:55 
GeneralRe: Controlling FileSystemWatcher Pin
DSAlbin24-May-06 13:22
DSAlbin24-May-06 13:22 
QuestionDataGrid Control Pin
Quecumber2569-May-06 11:27
Quecumber2569-May-06 11:27 
Questionhandler problem Pin
meconomou9-May-06 9:18
meconomou9-May-06 9:18 
Questioncombo box Data source Nothing Problem Pin
Hkothari779-May-06 9:02
Hkothari779-May-06 9:02 
AnswerRe: Data source Still Nothing Problem Pin
Hkothari779-May-06 9:04
Hkothari779-May-06 9:04 
QuestionHow to cut part of the piture in a picture box Pin
Murtuza Husain Miyan Patel9-May-06 8:58
professionalMurtuza Husain Miyan Patel9-May-06 8:58 
AnswerRe: How to cut part of the piture in a picture box Pin
Christian Graus9-May-06 11:39
protectorChristian Graus9-May-06 11:39 
QuestionAdding nodes to a treeview control Pin
Raistlin21_459-May-06 8:25
Raistlin21_459-May-06 8:25 
AnswerRe: Adding nodes to a treeview control Pin
digicd19-May-06 17:22
digicd19-May-06 17:22 
GeneralRe: Adding nodes to a treeview control Pin
Raistlin21_4510-May-06 7:01
Raistlin21_4510-May-06 7:01 
AnswerRe: Adding nodes to a treeview control Pin
Hacknight949-May-06 21:37
Hacknight949-May-06 21:37 
GeneralRe: Adding nodes to a treeview control Pin
Raistlin21_4510-May-06 7:05
Raistlin21_4510-May-06 7:05 
GeneralRe: Adding nodes to a treeview control Pin
Hacknight9410-May-06 15:15
Hacknight9410-May-06 15:15 
GeneralRe: Adding nodes to a treeview control Pin
Hacknight9410-May-06 15:21
Hacknight9410-May-06 15:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.