C# events for contrls

sivakumarl

Member
Joined
Mar 4, 2004
Messages
6
HI,

Please tell me how i could write the events for the controls in c#.net
In VB.net all the events corresponding to the control are shown in the IDE where as in c#.net those events are not visiible in the IDE.

Even if i wrote the event manullay it does not detect the functionality.
I request some one to please clarify my query.

Thank you,
 
Easiest way is in the IDE bring up the property windows (F4 by default).
You should see a button on the property window that looks like a yellow zigzag thing, click this and you will see the controls events - just double click the event in question.

The reason adding them in code doesnt work is you also need to associate the event handler with the event.
e.g.
C#:
  //given the following event handler
  private void button1_Click(object sender, System.EventArgs e)
          {
          
          }
  
  //the following code would need to be executed to associate them together
      this.button1.Click += new System.EventHandler(this.button1_Click);

using the IDE will automatically do this for you though.
 
Back
Top