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

Home Posts Topics Members FAQ

Event undefined value at runtime

i have 3 classes, class 1 has reference to class 2, class 2 has reference to class 3. i want to pass a value from class 3 to class 1, so 3 creates an event, 2 handels it then creates another event which 1 handels
the code for creating and handeling between each is the same except for the names however 3 -> 2 works but 2 -> 1 always failes with object not set to instance error. in debug it shows the event is set to undefined value.

In debug if i break after 1 sets the handel for 2 and go throguth the instance of 2 to see the event it does have a valid value, however when it gets to that part of 2 it nolonger has that value

so why is 3-2 working but not 2-1 when the code is almsot identical... i have event rewritten all the stuff with different names and its still the same
i have

Namespace

public delegate void MenuRefreshHandler(object o, ArrayList a)

class

private class2 c2
class1(

c2 = new c2()
c2.EventPassMenuRefresh += new MenuRefreshHandler(this.catchthing)
public void catchthing(object o, ArrayList a

//display cod


class

private class3 c3
public event MenuRefreshHandler EventPassMenuRefresh
class2(

c3 = new c3()
c3.EventMenuRefresh += new MenuRefreshHandler(this.MenuRefresh)
public void MenuRefresh(object o, ArrayList a

EventPassMenuRefresh(o,a)


namespace

class

public event MenuRefreshHandler EventMenuRefresh
class3(

/
public void eventmethod(

//stuf
EventMenuRefresh(null, al)

}
Nov 16 '05 #1
1 1489
Spike <an*******@discussions.microsoft.com> wrote:
i have 3 classes, class 1 has reference to class 2, class 2 has
reference to class 3. i want to pass a value from class 3 to class 1,
so 3 creates an event, 2 handels it then creates another event which
1 handels, the code for creating and handeling between each is the
same except for the names however 3 -> 2 works but 2 -> 1 always
failes with object not set to instance error. in debug it shows the
event is set to undefined value.

In debug if i break after 1 sets the handel for 2 and go throguth the
instance of 2 to see the event it does have a valid value, however
when it gets to that part of 2 it nolonger has that value.

so why is 3-2 working but not 2-1 when the code is almsot
identical... i have event rewritten all the stuff with different
names and its still the same.


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.

(The code you posted doesn't give enough information to reproduce the
problem.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

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

Similar topics

5
2148
by: Reza Roby | last post by:
The following code reports a runtime error "v has no properties." function ff() { var v; v.x=5; //error alert(v.x); } But this one alerts "undefined":
0
1843
by: Dave | last post by:
Hi everyone, (I already posted this to the VS.NET IDE news group without any responses, so I'm attempting one more time in this group) The issue I'm having is occuring in the IDE of VS.NET 2003, although I'm not sure what is actually causing the problem. I can't summarize the issue, so please read on to find out more. I've created a...
4
4897
by: Pai | last post by:
hello there, I am trying to rersize the window it works find in IE but doea not work with mozilla window.attachEvent(onload,MWSOnLoad); window.onload = function (MWSOnLoad) { alert('hello'); window.resizeTo(810,750); top.outerWidth=810;
2
1156
by: Antonio | last post by:
Hi, I have a simple user control with a public event that's raised by a datagrid selectindexchanged event. public event EventHandler UserAccountChosen; private void dgUserSearch_SelectedIndexChanged(object sender, System.EventArgs e) { if(UserAccountChosen != null) // here!! {
4
3006
by: Jordan | last post by:
I need to dynamically add an ImageButton control to a user control and and do some server-side processing when the user clicks it. While I the ImageButton is added to the user control at runtime, as needed, I'm having trouble wiring up its click event procedure. The problem is that when I go to subscribe the ImageButton to the delegate, the...
17
3324
by: yb | last post by:
Hi, Looking for clarification of undefined variables vs. error in JavaScript code. e.g. <script> alert( z ); // this will be an error, i.e. an exception </script>
2
2623
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
8
13592
by: jesmi | last post by:
my code is: addRecord.cfm <cfinclude template="head.cfm"> <p> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td> <div align="center">
15
4194
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is testing for support of particular eventTypes - the DOM 2 Events Interface DocumentEvent says that if the eventType is not supported, it throws a DOM...
0
7273
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
7574
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
7136
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
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5712
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
4769
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
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.