C# events list problem
-
My problem is, i have migrated from VB.net to C# recently. In vb.net, in the code window's left combo box we get the list of controls and in the right combobox we get the list of events associated with the selected control in the left combobox. And when we select an event from the combobox list vb.net writes the declaration for that event. But in C# i am finding difficulty in writing events by my own. I know how can we add events in C#, like, we have to go to windows designer code and write a new eventhandler like : this.button1.KeyDown += new System.EventHandler(this.button1_KeyDown); and then i have to go to my forms code window (i m using .net 2005) and write a method there with name "button1_Keydown". But my problem is i dont know what arguments i have to pass in this method. In vb.net the designer itself write the method with arguments for me so i dont have to worry about what are the event's arguments. Please help me how can i get the list of events with its arguments associated with a controls. Thansks in advance:). sheel
-
My problem is, i have migrated from VB.net to C# recently. In vb.net, in the code window's left combo box we get the list of controls and in the right combobox we get the list of events associated with the selected control in the left combobox. And when we select an event from the combobox list vb.net writes the declaration for that event. But in C# i am finding difficulty in writing events by my own. I know how can we add events in C#, like, we have to go to windows designer code and write a new eventhandler like : this.button1.KeyDown += new System.EventHandler(this.button1_KeyDown); and then i have to go to my forms code window (i m using .net 2005) and write a method there with name "button1_Keydown". But my problem is i dont know what arguments i have to pass in this method. In vb.net the designer itself write the method with arguments for me so i dont have to worry about what are the event's arguments. Please help me how can i get the list of events with its arguments associated with a controls. Thansks in advance:). sheel
-
In the designer select the control you want an event for. In the property grid switch to "events" and double click the event you want to implement.
Many thanks to you my friend. You solved my big problem. Happy Coding:-D Sheel sheel
-
In the designer select the control you want an event for. In the property grid switch to "events" and double click the event you want to implement.
Though personally i think this approach is perfect (and i admit using it often)... but I'd hate to rely on the UI designer for the control events and such. Most of the times, for the sake of clealiness, I myself associate the events manually. And the C# IDE has a great intellisense for events. As soon as you type "MyControl.Event+=" .. simply press "Tab" twice and it'll do the job. - Malhar