Events

  • Thread starter Thread starter Nikolay Petrov
  • Start date Start date
N

Nikolay Petrov

I have a sub which execute when a specidied event is fired.

Is there a way to enable this sub when it is needed, and disable it when
not?


TIA
 
Hi Nikolay,

I know that this will be a simple answer, but have you thought use a boolean
variable for this?.
If this variable has the True value, you'll execute that sub.
If is False, the sub won't be execute.

I hope that helps.

Kind Regards.

Jorge Serrano Pérez
MVP VB.NET
 
Nikolay Petrov said:
I guess I was asleep ;-)

Alternatively you can use 'RemoveHandler' to temporarily remove the handler
and use 'AddHandler' to add it again.
 

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

Back
Top