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?
Printable View
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?
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.
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.
Cool...I'll give it a try when I get home from work.
Thanks All
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.
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?
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#.
Yeah, there definetly seems to be a bias.
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.Quote:
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?
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.
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.
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.