lankymart
New member
I'm in the process of learning VB.NET and i'm currently trying to get to grips with building a File Search Class. The Class will behave like any object with Properties and methods and events. I have got quite way with the construction of this class but I'm am having problems deciding what would be the best way for it to work and be implemented in my application.
At the moment the class looks something like this (Outline):
I am at present adding the following functionality to the class:
The problems I am currently encounter are as follows:
Thank you in advance.
At the moment the class looks something like this (Outline):
VB.NET:
[color=blue]Public Class[/color] FileSearch
[color=blue]Public Event[/color] StateChanged()
[color=blue] Public Event[/color] PathChanged()
[color=blue] Public Sub[/color] New()
[color=blue] Public Sub[/color] New([color=blue]ByVal[/color] Path [color=blue]as[/color][color=blue] String[/color])
[color=blue] Public Sub [/color][color=black]BeginScan()[/color]
[color=blue] Private Sub[/color] Start()
[color=blue] Private Function[/color] PerformScan(SearchPath [color=blue]as String[/color])
[color=blue] Private Function[/color] GetLogicalDrives() [color=blue]as String[/color]()
[color=blue] Public Property[/color] CurrentPath() [color=blue]as String[/color]
[color=blue] Public Property[/color] DrivesToScan() [color=blue]as String[/color]()
[color=blue] Public Property[/color] ScanProgress() [color=blue]as Integer[/color]
[color=blue] Public Property[/color] ScanState() [color=blue]as[/color] ScanState
[color=blue]End Class[/color]
- Recursive file search, with filtering capability.
- Property reference to the current directory beening searched.
- The ability to "disable" the search at anytime or exit.
- Keep track of the files found that match the search criteria.
- Report when the search has completed or has failed using events.
The problems I am currently encounter are as follows:
- When application is exited if the FileSearch.BeginScan() method has been called the method will not finish until the search is complete.
- If FileSearch.BeginScan() is called more then once the thread will error. Need to capture the threadstate and work around this.
- Can't figure out how to implement a progressbar on my form that is updated by the FileSearch object without jeopardising the generic functionality of the class.
Thank you in advance.
Last edited: