473,516 Members | 3,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event being receiced more than once!

BACKGROUND
I have the following classes as part of a program that opens 3 Asynchronous
Sockets. Each socket is in a separate instance of a wrapping class.

1x User Interface class
1x Client Manager class
3x Client class Instances

The Client class raises events when the client connects.
The User interface has registered with that event.

PROBLEM
The UserInterface event handler is called between 1 and 3 times
The event is definately only firing once and the ui has definately only
registered for the event once so the question is - Why is the event handler
being called more than once!!!!????

Thanks,
Shaun
Sep 5 '06 #1
5 2363
Is that an event that you have declared and implemented?

I pretty sure the event has been hooked on more that once. If you have
declared the event try to change the declaration using add and remove
accessors. Then put a break point in the add accessor to see how many times
the event is hooked.
--
HTH
Stoitcho Goutsev (100)
"ShaunO" <Sh****@discussions.microsoft.comwrote in message
news:81**********************************@microsof t.com...
BACKGROUND
I have the following classes as part of a program that opens 3
Asynchronous
Sockets. Each socket is in a separate instance of a wrapping class.

1x User Interface class
1x Client Manager class
3x Client class Instances

The Client class raises events when the client connects.
The User interface has registered with that event.

PROBLEM
The UserInterface event handler is called between 1 and 3 times
The event is definately only firing once and the ui has definately only
registered for the event once so the question is - Why is the event
handler
being called more than once!!!!????

Thanks,
Shaun

Sep 5 '06 #2
The event is one that i have declared myself.
I gave it a subscribe function to handle anything that wanted to receive
notification of the event. The Subscribe event is only called once by the
client manager for each instance of the client class that it creates. (3
instances).

Interestingly, if the Clientmanager class instantiates X instances of the
client class then whenever the event is fired by any of the instantiated
classes, the ClientManager event handler is called X times.!

"Stoitcho Goutsev (100)" wrote:
Is that an event that you have declared and implemented?

I pretty sure the event has been hooked on more that once. If you have
declared the event try to change the declaration using add and remove
accessors. Then put a break point in the add accessor to see how many times
the event is hooked.
--
HTH
Stoitcho Goutsev (100)
"ShaunO" <Sh****@discussions.microsoft.comwrote in message
news:81**********************************@microsof t.com...
BACKGROUND
I have the following classes as part of a program that opens 3
Asynchronous
Sockets. Each socket is in a separate instance of a wrapping class.

1x User Interface class
1x Client Manager class
3x Client class Instances

The Client class raises events when the client connects.
The User interface has registered with that event.

PROBLEM
The UserInterface event handler is called between 1 and 3 times
The event is definately only firing once and the ui has definately only
registered for the event once so the question is - Why is the event
handler
being called more than once!!!!????

Thanks,
Shaun


Sep 5 '06 #3
Is it by any chance event declared as static? What you just described will
happen in this case.
--
Stoitcho Goutsev (100)

"ShaunO" <Sh****@discussions.microsoft.comwrote in message
news:A5**********************************@microsof t.com...
The event is one that i have declared myself.
I gave it a subscribe function to handle anything that wanted to receive
notification of the event. The Subscribe event is only called once by the
client manager for each instance of the client class that it creates. (3
instances).

Interestingly, if the Clientmanager class instantiates X instances of the
client class then whenever the event is fired by any of the instantiated
classes, the ClientManager event handler is called X times.!

"Stoitcho Goutsev (100)" wrote:
>Is that an event that you have declared and implemented?

I pretty sure the event has been hooked on more that once. If you have
declared the event try to change the declaration using add and remove
accessors. Then put a break point in the add accessor to see how many
times
the event is hooked.
--
HTH
Stoitcho Goutsev (100)
"ShaunO" <Sh****@discussions.microsoft.comwrote in message
news:81**********************************@microso ft.com...
BACKGROUND
I have the following classes as part of a program that opens 3
Asynchronous
Sockets. Each socket is in a separate instance of a wrapping class.

1x User Interface class
1x Client Manager class
3x Client class Instances

The Client class raises events when the client connects.
The User interface has registered with that event.

PROBLEM
The UserInterface event handler is called between 1 and 3 times
The event is definately only firing once and the ui has definately only
registered for the event once so the question is - Why is the event
handler
being called more than once!!!!????

Thanks,
Shaun



Sep 5 '06 #4
ShaunO <Sh****@discussions.microsoft.comwrote:
BACKGROUND
I have the following classes as part of a program that opens 3 Asynchronous
Sockets. Each socket is in a separate instance of a wrapping class.

1x User Interface class
1x Client Manager class
3x Client class Instances

The Client class raises events when the client connects.
The User interface has registered with that event.

PROBLEM
The UserInterface event handler is called between 1 and 3 times
The event is definately only firing once and the ui has definately only
registered for the event once so the question is - Why is the event handler
being called more than once!!!!????
Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 5 '06 #5
Thanks,
That's exactly what it was.
Removed the static and now works perfectly.

"Stoitcho Goutsev (100)" wrote:
Is it by any chance event declared as static? What you just described will
happen in this case.
--
Stoitcho Goutsev (100)

"ShaunO" <Sh****@discussions.microsoft.comwrote in message
news:A5**********************************@microsof t.com...
The event is one that i have declared myself.
I gave it a subscribe function to handle anything that wanted to receive
notification of the event. The Subscribe event is only called once by the
client manager for each instance of the client class that it creates. (3
instances).

Interestingly, if the Clientmanager class instantiates X instances of the
client class then whenever the event is fired by any of the instantiated
classes, the ClientManager event handler is called X times.!

"Stoitcho Goutsev (100)" wrote:
Is that an event that you have declared and implemented?

I pretty sure the event has been hooked on more that once. If you have
declared the event try to change the declaration using add and remove
accessors. Then put a break point in the add accessor to see how many
times
the event is hooked.
--
HTH
Stoitcho Goutsev (100)
"ShaunO" <Sh****@discussions.microsoft.comwrote in message
news:81**********************************@microsof t.com...
BACKGROUND
I have the following classes as part of a program that opens 3
Asynchronous
Sockets. Each socket is in a separate instance of a wrapping class.

1x User Interface class
1x Client Manager class
3x Client class Instances

The Client class raises events when the client connects.
The User interface has registered with that event.

PROBLEM
The UserInterface event handler is called between 1 and 3 times
The event is definately only firing once and the ui has definately only
registered for the event once so the question is - Why is the event
handler
being called more than once!!!!????

Thanks,
Shaun


Sep 6 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
472
by: Douglas Buchanan | last post by:
Some say there is no new row event for the VB.Net DataGrid. Hard to believe! Is that really true? I want to create a GUID in a hidden ID column when the user begins to enter data into a new row. The only way around I can think of is to test if the ID column is null any time a cells in a row is being edited, but it seems like the wrong...
3
12097
by: Melissa | last post by:
What specifically causes the Format event of a report's section to fire? Thanks! Melissa
4
4002
by: Peter Lin | last post by:
Dear all; I need to monitor a xml file so that I can update my data in hashtable, but the problem is it will trigger more than one event for a lastwrite action(I trigger this action by add something in the xml file using notepad). Here is my codes about using FilesystemWatcher fileWatcher=new FileSystemWatcher();...
3
4877
by: Peter Row | last post by:
Hi, I have created a user control consisting of a textbox and a separate vertical scroll bar. The textbox is filled with data. However there could be lots of data so I only fill the textbox with enough to fill the space visible without scrolling. Having set the min and max values of my separate vertical scrollbar I use that to scroll the...
8
2016
by: Hazz | last post by:
What is the triggering action that raises the event which causes my breakpoint to be reached, repeatedly, but does not allow my form to ever remain visible. I set a breakpoint on the line Graphics.. below. Just curious to help my 'system level' understanding. thx. -hazz private void InitializeComponent() { this.Paint += new...
7
7734
by: | last post by:
Hello to all I'm handling the Validating event for one text box. If something is wrong in user input I show a warning message. The problem is that if I add to method the message is displayed twice (event fired twice). Without event is fired once. if(txtMSG.Length > 0) {
13
3480
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the following issues still exist. The article shows how to find methods on a receiver that match the pattern OnXXXX given the sender. It loops through...
6
8755
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook launches. I've wired up my event handler to each Menu item and toolbar button. (I use the same Event handler and I use the Tag property which is...
1
3075
by: Mark Gilkes | last post by:
I have a DataGrid which I am adding to the page dynamically at the Init stage of the page load. The DataGrid has AutoGenerateColumns turned off, has BoundColumns and is bound to a DataView for its’ data source. I have also added a TemplateColumn which is defined in a derived class and contains an ImageButton. The derived TemplateColumn class...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.