how to keep running a "checking file function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cheekangteh
    New Member
    • Dec 2011
    • 7

    how to keep running a "checking file function

    i face a problem in checking file condition.
    I wish to create a program that can check the condition file continuously while the program is running.

    For code below that I wrote:


    Code:
    Private Sub StartTracking_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim FILE_NAME As String = "\Program Files\Fast_Automatic_Accident_Notification_Through_SMS\Resources\contact4.txt"
     
            If System.IO.File.Exists(FILE_NAME) = True Then
     
                MessageBox.Show("File already Exist")
     
                        ElseIf MessageBox.Show("File not Exist") Then
     
            End If
     
    End Sub
    It just can check the file condition only once, that this is only the program first load.

    If I suddenly remove the file, it can’t show a message “ File not Exist” or if I suddenly receive a file and place at the folder, it can’t show me a message “File already Exist”

    Kindly advice, How can I modify my code to continuously checking the file condition while the program is running.

    thanks a lot.
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    I would start with the FileSystemWatch er, which is designed to do the task you're trying to do.

    Comment

    Working...