VB to C#

C

Cyril Gupta

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.
 
B

Ben Voigt

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
*/ } }
}
 
G

Guest

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
 
M

Michael White

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top