Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 966445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:09:28+00:00 2026-05-16T02:09:28+00:00

I added FileSystemWatcher in Form1_Load like this: Private Sub Form1_Load(ByVal sender As System.Object, ByVal

  • 0

I added FileSystemWatcher in Form1_Load like this:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ....................
        Dim watcher As New FileSystemWatcher()
        'For watching current directory
        watcher.Path = "/"
        'For watching status.txt for any changes
        watcher.Filter = "status.txt"
        watcher.NotifyFilter = NotifyFilters.LastWrite
        watcher.EnableRaisingEvents = True
        AddHandler watcher.Changed, AddressOf OnChanged
End Sub

I have an OnChanged function which is a simple MessageBox. Still, when I change the status.txt file, no message box is shown.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:09:28+00:00Added an answer on May 16, 2026 at 2:09 am
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim watcher As New IO.FileSystemWatcher()
    
    'For watching current directory
    watcher.Path = **System.IO.Directory.GetCurrentDirectory()** 'Note how to obtain current directory
    watcher.NotifyFilter = NotifyFilters.LastWrite
    
    'When I pasted your code and created my own status.txt file using 
    'right click->new->Text File on Windows 7 it appended a '.txt' automatically so the
    'filter wasn't finding it as the file name was status.txt.txt renaming the file
    'solved the problem
    watcher.Filter = "status.txt" 
    
    AddHandler watcher.Changed, AddressOf OnChanged
    
    watcher.EnableRaisingEvents = True
    End Sub
    
    Private Shared Sub OnChanged(ByVal source As Object, ByVal e As IO.FileSystemEventArgs)
    MessageBox.Show("Got it")
    End Sub
    

    From http://bartdesmet.net/blogs/bart/archive/2004/10/21/447.aspx

    You may notice in certain situations that a single creation event generates multiple Created events that are handled by your component. For example, if you use a FileSystemWatcher component to monitor the creation of new files in a directory, and then test it by using Notepad to create a file, you may see two Created events generated even though only a single file was created. This is because Notepad performs multiple file system actions during the writing process. Notepad writes to the disk in batches that create the content of the file and then the file attributes. Other applications may perform in the same manner. Because FileSystemWatcher monitors the operating system activities, all events that these applications fire will be picked up

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to poll the file system for any changed, added or removed files
I added a dynamically added object like: @Html.EditorFor(model => model.Province) My model contains the
I added to my system-wide /etc/security/limits.conf the following two rows: * soft rtprio 55
I added this part of the code in my onCreate() method and it crashes
Added this code NSDateFormatter *df = [[NSDateFormatter alloc]init]; NSString *entry = @March 28, 2012;
Added an image from android market. I would like to know how can we
I added this code to the head but when I try to post something
I added swipeleft and swiperight listeners this way $(#slides li).swipeleft(function(){ console.log(!!!! swipe left); });
i added this line.but it gives error.how to import it? import org.andengine.opengl.texture.atlas.TextureAtlas;
EDIT: Added the NSRunLoop from my code, as mentioned by Deepak below. This was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.