C# IDE question, adding events

R

Rene

Hi,

I'm expierenced with C++ and VB6 and learning C#. I tried some small
application in VB.NET too.

But I'm stuck with the IDE: Say in put a button on a form and I double click
the button. C# generates the declarations for the Click event.

In VB6 and VB.NET (when I'm standing in the button_Click event code) I can
find in the dropdowns on top of the code window the name of the button (left
dropdown) and all events in the right dropdown. When I select an event the
code is generated or the IDE jump to an existing eventhandler.

But in C# I cannot find these handies, in the codewindow the left dropdown
shows one item (application.class) and the right dropdown shows only the
classmembers of the class.

Where is the magic button in C# projects to add eventhandlers like the
double click does on a button? I couldn't find a classwizard either (like
the MFC/C++ wizard).

Thanks,

Rene

btw: I'm using VS.NET 2003
 
J

Jon Skeet [C# MVP]

Rene said:
I'm expierenced with C++ and VB6 and learning C#. I tried some small
application in VB.NET too.

But I'm stuck with the IDE: Say in put a button on a form and I double click
the button. C# generates the declarations for the Click event.

In VB6 and VB.NET (when I'm standing in the button_Click event code) I can
find in the dropdowns on top of the code window the name of the button (left
dropdown) and all events in the right dropdown. When I select an event the
code is generated or the IDE jump to an existing eventhandler.

But in C# I cannot find these handies, in the codewindow the left dropdown
shows one item (application.class) and the right dropdown shows only the
classmembers of the class.

Where is the magic button in C# projects to add eventhandlers like the
double click does on a button? I couldn't find a classwizard either (like
the MFC/C++ wizard).

View the form in the designer, go to properties, and click on the
lightning bolt.
 
R

Rene

Jon Skeet said:
View the form in the designer, go to properties, and click on the
lightning bolt.

Thanks Jon, I found that a doubleclick is needed to add it.

I guess here we have a difference here between VB.NET and C# IDE. There is
an advantage in the 'C# way', events are grouped, but adding an event means
I must switch to the form designer, selected the control and then the event.

IMO the VB.NET way is faster and easier (but that is where VB.NET was ment
for) or do I miss something?

Rene
 
J

Jon Skeet [C# MVP]

Rene said:
Thanks Jon, I found that a doubleclick is needed to add it.

I guess here we have a difference here between VB.NET and C# IDE. There is
an advantage in the 'C# way', events are grouped, but adding an event means
I must switch to the form designer, selected the control and then the event.

IMO the VB.NET way is faster and easier (but that is where VB.NET was ment
for) or do I miss something?

Personally I don't use the designer much anyway - I write my production
GUI code by hand, on the grounds that it's then more maintainable. At
that stage, I write the handlers myself as methods and add the event
handlers to the appropriate objects in code. However... yes, if you're
using the designer, the VB.NET way is faster. I don't know for sure,
but I believe that in Whidbey (the next version of VS.NET) C# will get
the same functionality as VB.NET in this area.
 

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