Object sender, System.EventArgs e

  • Thread starter Thread starter J e r
  • Start date Start date
J

J e r

I'm trying to call ButtonClick( object sender, System.EventArgs e) from a
method rather than clicking the button. But I can't determine the values of
sender and e that I should use. I ran the program with a stop on, clicked
the button and opened up a watch window and it shows them as
System.Windows.Forms.MenuItem and System.EventArgs with all their
attributes.

My question is how do I determine the proper values of sender and e that I
can use to call ButtonClick(sender, e) ?

Thanks for your time, J e r
 
J e r said:
I'm trying to call ButtonClick( object sender, System.EventArgs e) from a
method rather than clicking the button. But I can't determine the values
of
sender and e that I should use. I ran the program with a stop on, clicked
the button and opened up a watch window and it shows them as
System.Windows.Forms.MenuItem and System.EventArgs with all their
attributes.

My question is how do I determine the proper values of sender and e that I
can use to call ButtonClick(sender, e) ?

In most cases:

ButtonClick(null, EventArgs.Empty)

will work just fine. If you actually use the sender parameter inside the
handler, you'll have to either provide the right control or else write the
handler to check for null and then avoid using sender.
 
J e r said:
I'm trying to call ButtonClick( object sender, System.EventArgs e) from a
method rather than clicking the button. But I can't determine the values
of
sender and e that I should use. I ran the program with a stop on, clicked
the button and opened up a watch window and it shows them as
System.Windows.Forms.MenuItem and System.EventArgs with all their
attributes.

My question is how do I determine the proper values of sender and e that I
can use to call ButtonClick(sender, e) ?

oops, this is C++/CLI group

that should have been nullptr and EventArgs::Empty
 
Back
Top