Results 1 to 6 of 6

Thread: [RESOLVED] [2.0] Lack of autogenerating Control Events unlike in VB.NET?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Resolved [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

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    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?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    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?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    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
  •  



Click Here to Expand Forum to Full Width