|
-
Jan 26th, 2007, 02:57 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2.0] Lack of autogenerating Control Events unlike in VB.NET?
Hey Guys,
I was wondering if it is possible to display all Events for each control just like in this screenshot for VB.NET IDE:

It is is real turn off for using C# because I have to manually add handlers in C#.
Thanks,
McoreD
-
Jan 26th, 2007, 03:09 AM
#2
Thread Starter
Addicted Member
Re: [2.0] Lack of autogenerating Control Events unlike in VB.NET?
After reading some differences between C# and VB.NET I came across this:
Event Handling
Another semantic difference is the event handling techniques in the two languages. In Visual Basic .Net it is possible to declare that a method can handle an event whereas, in C#, each event handler has to be added as a System.EventHandler to the actual event collection of the class instance.
Does this mean I am out of hope?
-
Jan 26th, 2007, 03:09 AM
#3
Re: [2.0] Lack of autogenerating Control Events unlike in VB.NET?
Actually, VB 2005 has taken a leaf out of C#'s book. In the current and previous versions of C# you generate or select event handlers from the Properties window. Click the Events button at the top and it will display the member events instead of the member properties. Double-click an event to generate an empty method or select an existing method from the drop-down list, which filters out all methods with incompatible signatures. VB 2005 provides this same functionality, although it's maintained the old way too.
-
Jan 26th, 2007, 03:18 AM
#4
Thread Starter
Addicted Member
Re: [2.0] Lack of autogenerating Control Events unlike in VB.NET?
Oh my God the Events button. That indeed does the job. Thanks jmcilhinney! I have absolutely nothing against C# now.
although it's maintained the old way too -- do you mean those Drop Down menu way in VB.NET's IDE (which is still lacking in C#) is the old way?
-
Jan 26th, 2007, 03:34 AM
#5
Re: [RESOLVED] [2.0] Lack of autogenerating Control Events unlike in VB.NET?
Yes I do. That's not to say that those drop-down lists are not useful or shouldn't be used, but they are more limited in what they can do than the Properties window. For instance, you cannot create a single method to handle multiple events that way. In VB you can create a handler for one event and then manually add another event to the Handles clause. C# has no Handles clause so there's one good reason why that mechanism is no good for C#. In VB.NET you should use whichever is most convenient at the time. I find it's about 50/50.
-
Jan 26th, 2007, 04:04 AM
#6
Thread Starter
Addicted Member
Re: [RESOLVED] [2.0] Lack of autogenerating Control Events unlike in VB.NET?
Understood well jmcilhinney. As usual well explained. Thank you very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|