PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Calling AddHandler more than once

 
 
Just Me
Guest
Posts: n/a
 
      16th Aug 2004
When a document is to be printed I call a method that contains an AddHandler
statement.

I just realized that if a second copy is to be printed the method is called
and the AddHandler is executed again.

Is doing AddHandler a second time wrong?

I did check and even though I do AddHandler 3 times the handler is only
called once.

Should I do a RemoveHandler after I'm finished with the handler so next time
the AddHandler will not be adding a duplicate?


Thanks


 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      16th Aug 2004
You should show the code in question.

However, calling AddHandler on the same object/method more then once, will
cause that method to be executed the # of times AddHandler is called.

Normally what happens it that all the event handlers for an object are
created once when the object is instantiated, and that is it. Doing this,
your handler would only be added once when the object is created, and that's
it.

" Just Me" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When a document is to be printed I call a method that contains an

AddHandler
> statement.
>
> I just realized that if a second copy is to be printed the method is

called
> and the AddHandler is executed again.
>
> Is doing AddHandler a second time wrong?
>
> I did check and even though I do AddHandler 3 times the handler is only
> called once.
>
> Should I do a RemoveHandler after I'm finished with the handler so next

time
> the AddHandler will not be adding a duplicate?
>
>
> Thanks
>
>



 
Reply With Quote
 
Just Me
Guest
Posts: n/a
 
      17th Aug 2004
Thanks for the help


"Marina" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> You should show the code in question.
>
> However, calling AddHandler on the same object/method more then once, will
> cause that method to be executed the # of times AddHandler is called.
>
> Normally what happens it that all the event handlers for an object are
> created once when the object is instantiated, and that is it. Doing this,
> your handler would only be added once when the object is created, and

that's
> it.
>
> " Just Me" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > When a document is to be printed I call a method that contains an

> AddHandler
> > statement.
> >
> > I just realized that if a second copy is to be printed the method is

> called
> > and the AddHandler is executed again.
> >
> > Is doing AddHandler a second time wrong?
> >
> > I did check and even though I do AddHandler 3 times the handler is only
> > called once.
> >
> > Should I do a RemoveHandler after I'm finished with the handler so next

> time
> > the AddHandler will not be adding a duplicate?
> >
> >
> > Thanks
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why use AddHandler? Jim Hubbard Microsoft Dot NET 7 15th Dec 2005 03:14 AM
AddHandler VB.NET and ASP.NET Landley Microsoft ASP .NET 3 19th Oct 2005 02:24 PM
Help in asp.net addhandler =?Utf-8?B?UGllcnJl?= Microsoft Dot NET 5 4th May 2005 04:51 PM
Using AddHandler Rick Palmer Microsoft VB .NET 10 6th Oct 2004 10:15 PM
AddHandler Micke Palm Microsoft ASP .NET 0 12th May 2004 09:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:14 PM.