Click here to Skip to main content
15,887,683 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: List(Of ObjectWithProperties) distinct property values Pin
David Mujica15-May-14 6:32
David Mujica15-May-14 6:32 
AnswerRe: List(Of ObjectWithProperties) distinct property values Pin
Eddy Vluggen15-May-14 7:53
professionalEddy Vluggen15-May-14 7:53 
GeneralRe: List(Of ObjectWithProperties) distinct property values Pin
Johan Hakkesteegt15-May-14 20:16
Johan Hakkesteegt15-May-14 20:16 
GeneralRe: List(Of ObjectWithProperties) distinct property values Pin
Mycroft Holmes15-May-14 22:41
professionalMycroft Holmes15-May-14 22:41 
QuestionWindow Service Does Not Stay "Alive" While Running Pin
ToolTimeTabor14-May-14 15:13
ToolTimeTabor14-May-14 15:13 
AnswerRe: Window Service Does Not Stay "Alive" While Running Pin
Bernhard Hiller14-May-14 21:51
Bernhard Hiller14-May-14 21:51 
AnswerRe: Window Service Does Not Stay "Alive" While Running Pin
Eddy Vluggen15-May-14 3:00
professionalEddy Vluggen15-May-14 3:00 
AnswerRe: Window Service Does Not Stay "Alive" While Running Pin
David Mujica15-May-14 6:25
David Mujica15-May-14 6:25 
I have a very similar windows service that does exactly what you are describing.

VB
 ' Create a new FileSystemWatcher and set its properties.
       Dim watcher As New FileSystemWatcher()

       watcher.Path = gsWatcherPath

       ' Watch for changes in LastAccess and LastWrite times, and
       ' the renaming of files or directories.
       watcher.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName Or NotifyFilters.DirectoryName)
       ' Only watch text files.
       watcher.Filter = "*.txt"

       ' Add event handlers.
       AddHandler watcher.Created, AddressOf OnChanged

       ' Begin watching.
       watcher.EnableRaisingEvents = True


Private Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)

       Call ProcessFile_Master(e.FullPath)

   End Sub


Once you instantiate the FileSystemWatcher, there is nothing else to do, no loops, nothing extra.

The Sub, OnChanged, gets fired for each file that is changed in the "watched" directory.

Hope this helps.
Thumbs Up | :thumbsup:
QuestionIf/and Statements Pin
David Rubin13-May-14 12:34
David Rubin13-May-14 12:34 
AnswerRe: If/and Statements Pin
Peter Leow13-May-14 14:33
professionalPeter Leow13-May-14 14:33 
AnswerRe: If/and Statements Pin
charliedev14-May-14 19:20
charliedev14-May-14 19:20 
Questionsave images as .gif Pin
khei-chan00712-May-14 17:44
khei-chan00712-May-14 17:44 
AnswerRe: save images as .gif Pin
Chris Quinn12-May-14 20:56
Chris Quinn12-May-14 20:56 
GeneralRe: save images as .gif Pin
khei-chan00712-May-14 21:25
khei-chan00712-May-14 21:25 
GeneralSaving Image as Gif Pin
I. Bandaranayake13-May-14 1:49
I. Bandaranayake13-May-14 1:49 
AnswerRe: save images as .gif Pin
Richard MacCutchan12-May-14 22:47
mveRichard MacCutchan12-May-14 22:47 
QuestionMapWinGis project in Visual Basic.NET Pin
Member 1081056711-May-14 7:32
Member 1081056711-May-14 7:32 
QuestionVB CODE TO RECEIVE SMS THROUGH GSM MODEM Pin
elly ianto10-May-14 2:34
elly ianto10-May-14 2:34 
AnswerRe: VB CODE TO RECEIVE SMS THROUGH GSM MODEM PinPopular
Dave Kreskowiak10-May-14 3:38
mveDave Kreskowiak10-May-14 3:38 
GeneralRe: VB CODE TO RECEIVE SMS THROUGH GSM MODEM Pin
elly ianto12-May-14 3:24
elly ianto12-May-14 3:24 
Questionentity framework too slow executing even a small query Pin
dilkonika9-May-14 14:11
dilkonika9-May-14 14:11 
AnswerRe: entity framework too slow executing even a small query Pin
Dave Kreskowiak10-May-14 3:43
mveDave Kreskowiak10-May-14 3:43 
GeneralRe: entity framework too slow executing even a small query Pin
dilkonika10-May-14 8:49
dilkonika10-May-14 8:49 
GeneralRe: entity framework too slow executing even a small query Pin
Dave Kreskowiak10-May-14 11:10
mveDave Kreskowiak10-May-14 11:10 
GeneralRe: entity framework too slow executing even a small query Pin
dilkonika11-May-14 5:45
dilkonika11-May-14 5:45 

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.