VB to C#

  • Thread starter Thread starter Guest
  • Start date Start date
Hello Dave,

There's no need to specify WithEvents in C#



-- You can do anything with a little bit of 'magination.

-- I've been programming so long, my brain is now software.
 
Mark Rae said:
Exp myExp;

more like:

private Exp theExp;
public Exp myExp {
get { return theExp; }
set { if (theExp != null) { /* unsubscribe all handlers from theExp */ }
theExp = value; if (theExp != null) { /* subscribe all handlers to theExp
*/ } }
}
 
Not really. In C#, the events are available for wiring by default, while in
VB you have to specify "WithEvents" to tell the compiler that you might want
(but might not want) to wire events.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
 
That was my first thought as well, but really, what makes withevents great
is that then the events become part of the class in there. What you need to
do also is add a proceedure to the class:
Exp myExp;
myExp.SomeEvent += EventHandler(MyEventHandler);
 
Back
Top