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

  • Home
  • SEARCH
  • 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 8519879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:22:34+00:00 2026-06-11T06:22:34+00:00

Alright my filesystemwatcher is not triggering until the first item in my listbox is

  • 0

Alright my filesystemwatcher is not triggering until the first item in my listbox is present. The files listed in the listbox will not be created in that order though.

Further explaination…

I’m taking the value entered in a textbox, and adding that value to a listbox and changing an icon next to that value in a picture box. The icon will alert the user that the PDF hasn’t been created yet.

    ListBox1.Items.Add(TextBoxTicketID.Text)

    If CStr(ListBox1.Items(0)) = TextBoxTicketID.Text Then
        PictureBoxStatus1.Image = My.Resources.Orange_Information
    ElseIf (ListBox1.Items(1)) = TextBoxTicketID.Text Then
        PictureBoxStatus2.Image = My.Resources.Orange_Information
    ElseIf (ListBox1.Items(2)) = TextBoxTicketID.Text Then
        PictureBoxStatus3.Image = My.Resources.Orange_Information
    End If

    TextBoxTicketID.Text = ""

    Call CheckPDFs()

The following is how I’m currently checking to see if the PDF has been created.

Eventually, in the private sub where the msgbox is at, I want to update the icon next to the ID to a green check mark, indicating the PDF has been created.

Public Sub CheckPDFs()
    Dim x As Integer
    Dim Watcher As New FileSystemWatcher()
    Watcher.Path = "C:\Temp\"
    Watcher.NotifyFilter = (NotifyFilters.Attributes)
    Watcher.Filter = ListBox1.Items(x) + ".pdf"

    AddHandler Watcher.Changed, AddressOf OnChanged

    Watcher.EnableRaisingEvents = True
End Sub

Private Shared Sub OnChanged(source As Object, e As FileSystemEventArgs)
    Dim x As Integer
    ' Specify what is done when a file is created.
    MsgBox("File has been created!")
End Sub

When I run the test, I created two unigue IDs entered into the listbox.

Issue1: I create a PDF manually by the first ID I entered, nothing triggers. I have to move the PDF out of the directory and back into before it triggers the msgbox.

Issue2: If I entered says two IDs, I create the second ID manually, nothing triggers. I move the file out of the directory and back in, still not triggering.

Why does the first ID need to be present before triggering any ID entered after it?

EDIT

Here two screenshot, before a user enters and after, showing the IDs entered and the icon.

Before_IDs_Entered

After_IDs_Entered

  • 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-06-11T06:22:36+00:00Added an answer on June 11, 2026 at 6:22 am

    Your code does not show how you have your Watcher.NofityFilter set. If you want an event raised when a file is finished being written – and is ready to be used – then you must set it as follows:

    Watcher.NotifyFilter = NotifyFilters.Attributes;
    

    Then remove the Watcher.Created event you have listed; you want to have only the Changed. Otherwise you will receive two events: one for the file being created with zero bytes in it, and the other for when the file is done being written. I believe you only care when the file is done being written.

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

Sidebar

Related Questions

Alright so i need to open a .txt file that will be created in
Alright, currently I have my SWF hitting a php file that will go and
Alright let me explain my situation first: I am part of an organization that
Alright, here we go! I am currently developing an iPhone app that will work
Alright, I found out in this question that polling sockets does not scale, so
Alright I created some custom classes for my project sourced from this tutorial ,
Alright so this is a bizarre cross platform thing that I'm experiencing with text
Alright y'all. I am attempting to write a bit of code that places typographic
Alright guys, I have looked on the internet for ages and simply could not
Alright not sure what to do and i am honestly bit lost. What I

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.