Watching Folder Activity in VB.NET

Introduction

Have you ever wanted to write an application that constantly monitors a folder and raises events when there is any activity in that folder? In the good old days using VB6, you had to use windows APIs to do something like this, which was not very simple and required a lot of coding.

The Microsoft .NET Framework has introduced classes like System.IO and System.Diagnostics, which contain the FileSystemWatcher class. This class can raise events when a file is created, renamed, updated or deleted from the specified folder.

In this article we're going to learn how to implement the FileSystemWatcher class using Microsoft Visual Basic.Net. You will need the .NET framework installed, as well as Visual Studio.Net if you want to experiment with the source code presented in this article.

You might also like...

Comments

About the author

Jayesh Jain

Jayesh Jain New Zealand

Jayesh Jain is working as a Business Analyst in Auckland, New Zealand. He has several years of n-Tier development experience in developing interactive client solutions. He has a passion for Web ...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Rick Osborne