Event visibility

J

John Dann

An elementary question I know, but I've just realised that I don't
know the answer:

I want to use the FileSystemWatcher component. Its only obvious way
of use is to add this to a form. (Maybe there is a way of adding it to
a non-form class?). But I want to handle the FSW event in a non-form
class. But despite having reset its scope from Friend to Public (maybe
Friend is the right choice anyhow?) the FSW events don't appear on the
dropdown list of other classes. What do I need to do please?

TIA
JGD
 
K

Ken Tucker [MVP]

Hi,

Declare the variable withevents to have access to the events

Public Class MyFileWatcherClass

Private WithEvents fsw As New System.IO.FileSystemWatcher("C:\Temp")



End Class



Ken

---------------------------

An elementary question I know, but I've just realised that I don't
know the answer:

I want to use the FileSystemWatcher component. Its only obvious way
of use is to add this to a form. (Maybe there is a way of adding it to
a non-form class?). But I want to handle the FSW event in a non-form
class. But despite having reset its scope from Friend to Public (maybe
Friend is the right choice anyhow?) the FSW events don't appear on the
dropdown list of other classes. What do I need to do please?

TIA
JGD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top