The ScanningFolder event is raised whenever a folder is scanned for matching items while building a list of items to process.
The main purpose of the ScanningFolder event is to prevent your application from appearing frozen during long operations. For example, if you were to handle the ByteProgression event in conjunction with the ScanningFolder event, the ScanningFolder event could return information on the folders being scanned during the first pass of the ByteProgression event.
To subscribe to the ScanningFolder event, the following steps must be performed:
Create a reference to a FileSystemEvents object.
Subscribe to the ScanningFolder event of the FileSystemEvents object using the ScanningFolderEventHandler delegate class.
Create a new method that will handle the events that are raised. For the purposes of this example, we will call the method OnScanningFolder.
Place the desired code in the newly created event handler.
To subscribe to the ScanningFolder event, the following steps must be performed:
Create a reference to a FileSystemEvents object using the WithEvents keyword.
Select the ScanningFolder event from the list of available methods in the newly instantiated FileSystemEvents object. This is done in the same manner as, for example, adding the DoubleClick event of a ListBox.
You can also subscribe to the event using the AddHandler/AddressOf statement.
Place the desired code in the newly added event handler.
This example demonstrates how to copy files to a folder located on disk and display progress information while the folder are being scanned.
VB.NET | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
using Xceed.FileSystem; |