Quote:
File watcher in a module will not call method in a form.
If the method in the form is not
Public
then it cannot be called from outside the context of the form.
Quote:
When the module code is moved to the form it all works well.
Because the file watcher and the form method are now encapsulated in the same context or scope - i.e. the form.
Beware! Just changing the method to
Public
is not necessarily the right solution. Should that method be on the Form or in a module - it sounds to me as if it should not be on the UI Component and should probably be on a separate thread.
However, start with the link from @Sadeep-Mewara - reproduced here as a clickable link
Watching Folder Activity in VB.NET[
^]
And if you want to it with Threads start here
BackgroundWorker Class Sample for Beginners[
^] - it's in C# but read the theory (and there are plenty of C# to VB.NET converters on-line)