Very Basic C# From Question

B

Brent

Hi everyone. I am moving from VB.Net to C#. C# is pretty easy but i do have
one thing i don't like that im probably doing it the hard way and want to
see if there is an easy way to do it. When you want to code an event for a
control on a form in VB.Net you just select the control from the left
comobox on top of the code window. You then select the event from the right
combobox. Apparently C# doesn't have this. Say you want to code off the
LostFocus event on button 1. The way i currently do it is to write the
following code manually:

this.button1.LostFocus += System.EventHandl..........

This is kind of a pain. You have to manually code the event handler function
and you also have to look at exactly what type of eventargs to pass in the
function? Is there an easier way to do this or is this the only way?



thanks

Brrent
 
S

Steve Long

Well, the other way to do it is to select the control or form that you want
to add an event handler for and click the events button on the properties
window, then double click the event handler you want to add. Simple right?

HTH
Steve
 
C

Carlos J. Quintero [.NET MVP]

The Properties window of C# controls have an Events button that VB does not
have.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

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

Top