Beginner question

Morpheus

Regular
Joined
Jan 18, 2002
Messages
62
I have used VB 6 before but now I'm moving to C#.

When you make a textbox in VB 6 the textbox have different events like KeyPress. I can't find anything like that in C#. So how do I do to get my program to respond to KeyPress event?
 
In the properties window, click the little Lightning bolt icon. The
properties list will change to an events list. Type the desired name
of your event sub beside the event you want, and press enter.
It will now add the event handler to your control.
 
While focused on the control in design view, goto the properties window and click on the Lightning-Bolt (Events) then double-click on the event you wish to use.

[edit]beaten to the punch. :( [/edit]
 
Cool!

I wasn't aware of the events button on the properties window. Up until now, I've always used the code window and it's object/procedure drop-down menus to get into the various event handlers.

Thanks,
Shuaib
 
Those aren't available in C#. That's why you do it this way. Likewise,
the event button is not available in VB.NET.
 
Back
Top