I'm currently building a Queue Systems for processing Customer Information. These file are processed as they are received and I am trying to build a queue to hold the file names for sequential processing. I tried building one with the QUEUE Class but was unable to get it to update more than One Item in the Que. The Idea is that every time a file is dropped into this Directory the File watcher should be activated and place the item in the que where it will be processed in sequential order. But thats not the case, Instead It will process one at a time but it will not accecpt multiple files and then process the sequentially. It overides what is supposed to happen and I'm confused as hell. Any Help would be appreciated. Thank you.

Private Sub FileSystemWatcher1_Changed(ByVal sender As _ System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles QUEwatcher1.Changed
        Dim i As String
        Dim myQ As New System.Collections.Queue
        Dim QueItem as String
        
        QueItem = e.Name
        i = QueItem

        myQ.Enqueue(i)


        CountItemsQuelbl.text = myQ.Count()
        myQ.Peek()
        myQ.Dequeue()



    End Sub

Recommended Answers

All 3 Replies

You should us multi-threading here, as soon as the file system watcher detects a file it should start the processing in a seperate thread, and while the file is still being processed if another file is detected then the file watcher should start a new thread to handle the processing of the file. i.e. everyfile should be processed by a separate thread, or you could look at the possibility of creating a thread pool.

You should us multi-threading here, as soon as the file system watcher detects a file it should start the processing in a seperate thread, and while the file is still being processed if another file is detected then the file watcher should start a new thread to handle the processing of the file. i.e. everyfile should be processed by a separate thread, or you could look at the possibility of creating a thread pool.

Could you direct me in the direction of finding some material of Multi threading. I've been doing VB.net for about 3 weeks. Also, knowing what little I do know about Vb.net. The files I'm looking to process have hundreds of thousands of records that all have to be processed Line by line. I don't really know the impact of multiplye threads or Proccess on the performance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.