Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET - RaiseEvent Command 1

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
GB
Hi,

I am in the process of learning VB.NET and have a quick question:

I am current;y looking at WithEvents and it is slowly sinking in. Why isn't it possible to raise and event within the Sub New() procedure though? It works in all the other Subs within my class, but not in Sub New()....

Many thanks for any help.

Ed.

Please do not feed the trolls.....
 
Why would you want to?
Also, sub new is executed when the calling code is instantiating the object. Until it has finished, the caller does not have a reference to an instance of the object, and so cannot possibly be listening for events from it.

Mark [openup]
 
Mark,

Good point!

Cheers,

Ed Metcalfe.

Please do not feed the trolls.....
 
Mark,

Good point!

Cheers,

Ed.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top