473,503 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pb firing events with VC 2005

Hi,
Still having problems with converting my VC 2003
project to VC 2005 beta, this time with events (using the new
C++ syntax).

My class defines the following event:
event PropertyChangedEventHandler ^ PropertyChanged;

(it uses the System.ComponentModel.PropertyChangedEventHandler delegate)

When I try to fire the event:
PropertyChanged(this, gcnew PropertyChangedEventArgs("Size"));

I get a 'System.NullReferenceException'

If I look in the "Autos" Debug window, I see:

- this
<PropertyChanged> <undefined value>
Is it normal ?
What am I doing wrong ?

Chris.
Nov 17 '05 #1
2 1226
Chris,
Still having problems with converting my VC 2003
project to VC 2005 beta, this time with events (using the new
C++ syntax).

My class defines the following event:
event PropertyChangedEventHandler ^ PropertyChanged;

(it uses the System.ComponentModel.PropertyChangedEventHandler delegate)

When I try to fire the event:
PropertyChanged(this, gcnew PropertyChangedEventArgs("Size"));

I get a 'System.NullReferenceException'

If I look in the "Autos" Debug window, I see:

- this
<PropertyChanged> <undefined value>
Is it normal ?
What am I doing wrong ?


Do you have any delegates attached to this event? Usually, when coding calls
to an event, you always need to check if it is null first (in which case no
one has subscribed to the event yet)
In the end, the event is only a multicast delegate with another extra piece
of metadata...
--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2
Tomas Restrepo (MVP) wrote:
Do you have any delegates attached to this event? Usually, when coding calls
to an event, you always need to check if it is null first (in which case no
one has subscribed to the event yet)
In the end, the event is only a multicast delegate with another extra piece
of metadata...


OK. I hadn't realized that the value of the delegate
should be tested. I had no receiver connected to the event.
Thanks.
Nov 17 '05 #3

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

Similar topics

3
2277
by: Mike | last post by:
Hi, I am adding controls dynamically in a WebForm, but none of these controls' events fire. Here is the class code I am using. I have tried so many things, but nothing works :-( namespace...
3
3468
by: michael_vanommeren | last post by:
I have two web applications that I am working with and I am trying to do a Response.Redirect from one to the other. They are setup as separate web applications on the same IIS server. If I go...
5
4371
by: bryanp10 | last post by:
I have a page that is almost entirely dynamically created. Textboxes and checkbox are working fine, firing events, and persistent their state. DropDownList is giving me a major headache. All...
28
10221
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when...
19
10158
by: furiousmojo | last post by:
This is a strange problem. I have a project where the contents of global.asax application_error are not firing. It is an asp.net 2.0 application using web application projects. I have another...
5
4635
by: Joe | last post by:
Hi I am adding a class to a ComboBox - and all is fine except that I fill the combobox on the Form_Load Method and it causes the method private void comboBox2_SelectedIndexChanged(object...
14
8639
by: TS | last post by:
I have this custom data list control and i override the onItemDatabound event. After upgrading to vs 2005, this event is not always getting called, though it does at other times. No changes were...
1
1732
by: TimmyTurner | last post by:
Hi all I'm working on a ASP.NET, C# project on Visual Studio 2005, using a MSDB in _vista_. My problem is that the events for the buttons are not firing. I've searched the web and the solution...
5
2056
by: greg | last post by:
Written in Asp.Net 2.0 The session_start fires on Development server running withing Visual Studio 2005 and also if access web site via localhost on development machine. But if copy to...
4
2026
by: Joergen Bech | last post by:
I sometimes use delegates for broadcasting "StateChanged" events, i.e. if I have multiple forms and/or controls that need updating at the same time as the result of a change in a global/common...
0
7199
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,...
0
7076
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...
0
7323
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...
0
7453
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...
0
5576
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,...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4670
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...
0
3162
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...
0
1507
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 ...

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.