Missing Events in C#

  • Thread starter Thread starter SRLoka
  • Start date Start date
S

SRLoka

I am learning C# for the Compact Framework. I put a PictureBox on a form.
But when I click on the events button(on the Properties Tab), only
ParentChanged, Validated and Validating are listed. There is no click event.
But if I manually code for a Click event, it works. I added this line after
the call to InitializeComponent()
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);

This works but I am curious as why it is not listed on the properties tab
(its documented as a valid event) and I want to do it the right way.

Thanks

Srinivas
 
Watch out. There is a lot of events that are not raisedn from CF controls.
I have such a problem with the click event in a label.

(see the "Can't handle Label click event" thread)
 
You've done it the right way - the designer simply adds the same line of
code you did.

-Chris
 
It's weird b/c all of the controls will show a click event. in the case of
a picture box, you can just add the eventhandler and the corresponding code
to handle it,and life is good. On the other hand, if you do it with a label
control, nothing happens. In many regards, it's trial and error b/c
this.Click will show with both controls, it just won't work with one.
 
Back
Top