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
Ben Voigt [C++ MVP] - 10 Sep 2007 15:00 GMT
> 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
[quoted text clipped - 6 lines]
> 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.
> Thanks for your time, J e r
Ben Voigt [C++ MVP] - 10 Sep 2007 15:00 GMT
> 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
[quoted text clipped - 6 lines]
> 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
> Thanks for your time, J e r