473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Why don't events raise in Sub New?

Subject says it all. I want to raise an event in Sub New
of a class but it is not being raised to my client app.

I can raise events just fine in other procedures... just
not sub new.

Why is this?

Thanks in advance!
Nov 20 '05 #1
2 1584
it's not instanciated yet.

"IcedCrow" <ch********@aol.com> wrote in message
news:07****************************@phx.gbl...
Subject says it all. I want to raise an event in Sub New
of a class but it is not being raised to my client app.

I can raise events just fine in other procedures... just
not sub new.

Why is this?

Thanks in advance!

Nov 20 '05 #2
IcedCrow,
As steve stated, because the object itself is not fully instantiated, which
means that no event handlers have been connected to it yet. as the calling
routine has not received the object yet to add handlers to its events.

The only why that I know of to "raise an event" from Sub New is to pass a
delegate or object as a parameter to the constructor then the constructor
itself calls the delegate or uses AddHandler (directly or indirectly) to the
object that was passed in. After the handlers are connect, then the
constructor can raise the event.

Hope this helps
Jay

"IcedCrow" <ch********@aol.com> wrote in message
news:07****************************@phx.gbl...
Subject says it all. I want to raise an event in Sub New
of a class but it is not being raised to my client app.

I can raise events just fine in other procedures... just
not sub new.

Why is this?

Thanks in advance!

Nov 20 '05 #3

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

Similar topics

4
by: Eric | last post by:
I need to raise events from a c# class to the caller, a c# or vb form. In VB you would declare the event in the class, then just use the RaiseEvent to raise the event, in the form you would just...
8
by: Edward Diener | last post by:
Is it possible for a derived class to override a property and/or event of its base class ?
8
by: JPRoot | last post by:
Hi M. Jeffrey Tan, Just hopping you didn't forget me? :) Thanks JPRoot ----- \"Jeffrey Tan\" wrote: -----
2
by: Andrew | last post by:
Hi, friends, I need to raise certain events in my VC# windows control library. Any reference paper or sample source code for help? Thanks a lot...
10
by: Chad Miller | last post by:
I currently have a base form that I inherit. The base for has a custom event. The event will not raise threw the inherited form. I was wondering if events work threw inheritance or should I use...
5
by: snesbit | last post by:
If a screen is made up of several user controls and those user controls contain various packaged or standard controls such as a grid, how do you raise both standard and custom events from the user...
2
by: Gman | last post by:
Hi, I have created a usercontrol, a grid control essentially. Within it I have a class: clsGridRecord. I have coded the events such that when a user clicks on the grid, say, the events occur on...
1
by: Apu Nahasapeemapetilon | last post by:
Hello and thank you in advance for your help. Can anyone think of a reason why this code would work properly on one PC, but not another? I've got a System.Windows.Forms.UserControl that...
3
Frinavale
by: Frinavale | last post by:
Background An Event is a message sent out by an object to notify other objects that an action/trigger/state-change (ie. an event) has taken place. Therefore, you should use an event when an object's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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...

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.