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 John Tel 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 Code

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
GB
Another WithEvents question..... :)

You use the RaiseEvent command within the subs in the class. Why does the code that the RaiseEvents command triggers have to be in a standard module? Wouldn't it sit better in the class?

TIA,

Ed.

Please do not feed the trolls.....
 
None of the code to do with events (the RaiseEvent statement itself, the class being declared WithEvents, the declaration of the Event, or the code reacting to the event (via the handles clause or the AddHandler statement) has to be put in a standard module. It all should work fine in classes.

Mark [openup]
 
Hmmm..... I'll have to give it another go. It didn't seem to be working when the code reacting to the event was placed inside the class.

I thought this was because the "Handles" keyword relates to the Object variable, not the class itself?

Ed Metcalfe.

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

Part and Inventory Search

Sponsor

Back
Top