Tuesday, July 14, 2009

Working with C# in Visual Studio beginner question?

In VB.NET's code editor, there's a drop-down menu of events to choose from for the form and each of its controls. In C#, the right drop-down menu contains the name of the controls instead. How do I pick controls' events and have the IDE automatically insert a handler for them?

Working with C# in Visual Studio beginner question?
select the control, go to the properties window click on the icon with lightening bolt on it and you will see the list of events, double click the event and there you go!
Reply:In C#, choose the form from the "Solution Explorer" window or select the control on the form. Then go to the "Properties" window. Notice that there is a "lighting bolt" icon on the Properties window. Click that. Now you will see a list of all of the events that relate to the form and/or control. Scroll until you find the event you want and double-click. This will create the event handler method for you complete with the correct signature. Just add your own code from there.
Reply:If you right-click a control and select properties you'll get a window that allows you to select properties. At the top of the dialog is a lighning bolt icon. Click the lightning bolt icon to see a list of events.


No comments:

Post a Comment