So I read a little deeper and it sounds like if you're not going to
handle events for a Type, you really shouldn't use WithEvents.
Does that sound right?
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Mark Wonsil
Sent: Wednesday, September 29, 2010 7:17 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] VB.Net Question
Hi Joe,
variable:
http://msdn.microsoft.com/en-us/library/aa711970(VS.71).aspx
...
The WithEvents modifier causes the variable to be renamed with a
leading underscore and replaced with a property of the same name that
does the event hookup. For example, if the variable's name is F, it is
renamed to _F and a property F is implicitly declared. If there is a
collision between the variable's new name and another declaration, a
compile-time error will be reported.
The implicit property created by a WithEvents declaration takes care
of hooking and unhooking the relevant event handlers. When a value is
assigned to the variable, the property first calls the remove method
for the event on the instance currently in the variable (unhooking the
existing event handler, if any). Next the assignment is made, and the
property calls the add method for the event on the new instance in the
variable (hooking up the new event handler).
...
Mark W.
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
jrojas@... | www.matsinc.com Ask us about our clean, green and beautiful matting and flooring
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
handle events for a Type, you really shouldn't use WithEvents.
Does that sound right?
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Mark Wonsil
Sent: Wednesday, September 29, 2010 7:17 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] VB.Net Question
Hi Joe,
>It seems to be an automatic thing when you declare With Events on a
> When looking at code that was created by someone else, I see module
> level variables defined.
>
> For example: Private WithEvents edvProject As EpiDataView
>
> Later in the module, I see this variable referenced with a leading
> underscore.
>
> For example: _edvProject
>
> The two refer to the same variable. I confirmed this by testing it out
> in Visual Studio.
>
variable:
http://msdn.microsoft.com/en-us/library/aa711970(VS.71).aspx
...
The WithEvents modifier causes the variable to be renamed with a
leading underscore and replaced with a property of the same name that
does the event hookup. For example, if the variable's name is F, it is
renamed to _F and a property F is implicitly declared. If there is a
collision between the variable's new name and another declaration, a
compile-time error will be reported.
The implicit property created by a WithEvents declaration takes care
of hooking and unhooking the relevant event handlers. When a value is
assigned to the variable, the property first calls the remove method
for the event on the instance currently in the variable (unhooking the
existing event handler, if any). Next the assignment is made, and the
property calls the add method for the event on the new instance in the
variable (hooking up the new event handler).
...
Mark W.
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
jrojas@... | www.matsinc.com Ask us about our clean, green and beautiful matting and flooring
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]