Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: multi threading


Message #1 by "sundar srinivasan" <ssrinivasan3@n...> on Wed, 27 Nov 2002 23:00:21
> From my aspx.vb I am spawning a thread of GetDocument() as follows:

>     Dim WithEvents objDocument As New clsDocument()
 > 
o> bjDocument.intDocumentID = CInt(Request.QueryString("KEY1"))

> AddHandler objDocument.GetDocumentDone, AddressOf 
G> etDocumentDoneEventHandler

> Dim Thread As New System.Threading.Thread(AddressOf 
o> bjDocument.GetDocument)

> Thread.Start()

> The event I am raising in objDocument is GetDocumentDone and I am 
handling 
i> t in sub GetDocumentDoneEventHandler in my ASP page.

> Problem is, this event is getting fired multiple times..What could it be?

> Sundar

The problem is this:

I have a 'handles objDocument.GetDocumentDone' in the event handler 
routine. This coupled with the addHandler statement makes it two event 
handlers for the same event. By removing either the addhandler or the 
handles clause in the sub, The problem is rectified. 
Thanks to those who have mulled over this...

  Return to Index