Results 1 to 11 of 11

Thread: Where are the event stubs?

  1. #1

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496

    Where are the event stubs?

    Is there a way to get a list of all the events for a control, such as keypress or keydown, such as in the visual basic ide dropdown. Do I have to manually add handlers for such events that I want to sink?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I'm pretty sure C# and VB.NET are the same on this one. They hide it in the two combo's at the top of the Code view page. you have to select the control or object in the list on the left and then it'll show the available events in the one on the right.

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    On the property page there should be a little yellow lightening bolt. Click on it and you will see all the events that are associated with the control you are currently working on. Double click the one you want and VS will wire it up for you.
    Dont gain the world and lose your soul

  4. #4

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Cool...I'll give it a try when I get home from work.

    Thanks All

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    It took me awhile before I got this one myself. Like DevGrip said, click the lightning bolt above the properties for the control. Notice how you can use the drop down button to assign the event to an already existing method. I thought that was cool. Or you can just double click it, and it will create a new one for you.

    What I would recommend though, is to name your controls before double clicking on and creating event methods. Otherwise you will have events that are like text1_click, even though you change the name later. This is due to the delegates pointing to that method, and the IDE won't change the methods name if you change the controls name later.

  6. #6

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Hey Hellswrath,
    I've also noticed that when I type the following for example,
    e.KeyChar = , I do not get an intellisense list of enum constants as in vb.net or vb6. Is there another way of gettings this support?

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    That's cool. Isn't it wierd that there are little IDE differences between VB and C# even though they use the same IDE (sorta). I wish they would have made all these things standard. Like the Class, Method, Property Wizard bit too and the xml documentation. It seem that MS really did favor C#.

  8. #8

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Yeah, there definetly seems to be a bias.

  9. #9
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by Lethal
    Hey Hellswrath,
    I've also noticed that when I type the following for example,
    e.KeyChar = , I do not get an intellisense list of enum constants as in vb.net or vb6. Is there another way of gettings this support?
    I never really knew there should be an intellisense after the = sign. So, no, I don't know how to get it. If I am miss-understanding you, please tell me.

    Just a shot in the dark, if your typing a variable and you don't know the spelling or whatever, but you know the first couple letters, you can type what you know, then hit Ctrl + Space and it will either complete your variable, or give you a intellisense list of variables/methods that match what you have typed so far. This also is useful when your used to VB and case doesn't matter with variables. I just start typing the name, and when I get towards the end I just hit Ctrl + Space and it will capitalize and correctly put the variable name in.

  10. #10

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Yeah, I know about the ctrl + space auto-complete. Try going into VB.NET and trapping for a keycode in the keydown event of a textbox, you'll see what I mean. Not a big deal, the lack of intellisense will ultimately make us a better programmer.

  11. #11
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I understand now.
    Since you already have the System.Windows.Forms namespace specified in a windows forms project, all you have to do is type the word Key. and you will get the same thing:

    e.KeyChar = Key.

    It would have been nice if they would have done this for the C# editor also, but then again, it probably missleads people as to believe those are thier only choices, which we know isn't true.

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