Firing Events from Modile containing a Threads code
From: James Anderson (anonymous_at_discussions.microsoft.com)
Date: 05/24/04
- Next message: Pieter: "RE: WebRequest ObjectDisposedException"
- Previous message: Chris Tacke, eMVP: "Re: How to capture native exception?"
- Next in thread: Chris Tacke, eMVP: "Re: Firing Events from Modile containing a Threads code"
- Reply: Chris Tacke, eMVP: "Re: Firing Events from Modile containing a Threads code"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 May 2004 03:56:03 -0700
Hi,
Ive been advised to use events in my app. I have a worker thread that listens for UDP packets. It converts the incoming UDP Byte array into a Packet object. This then gets placed onto a ReceivedPackets Queue. Im not too familiar with Events but need to know how to get my thread to fire the event and my form, could 1 of 9 forms, to detect that event has been fired and handle it.
I know that I should use "RaiseEvent" in the Thread. The thread has been declared in a Module. How do I put it all together? I guess the forms need something like "AddHandler EventName, New EventHandler Addressof procedureToRun" but donr know how to put it all together. I tried but the Thread was complaining of an "End of statement expected" compilor error.
Also, If Ive received 2 packets with a 200ms interval between them and hence the event gets fired twice, what happens? does the app wait for the first procedure to finish executing and then call the method again in response to the second event firing? Can this cause potential delay/problems in my app?
Im using VB.NET but C# will suffice.
Thanks.
- Next message: Pieter: "RE: WebRequest ObjectDisposedException"
- Previous message: Chris Tacke, eMVP: "Re: How to capture native exception?"
- Next in thread: Chris Tacke, eMVP: "Re: Firing Events from Modile containing a Threads code"
- Reply: Chris Tacke, eMVP: "Re: Firing Events from Modile containing a Threads code"
- Messages sorted by: [ date ] [ thread ]