On 2007-10-31 12:12:00 -0700, CMartin <CM*****@discussions.microsoft.comsaid:
How do I call the "buttonRun_Click()" method in C#?
I can do this so easily in VB but I have yet to figuere out how in C#. I
keep getting errors.
And in addition to what Nicholas wrote, what do you mean "call it"?
Even in VB, given that the method name looks a lot like an event
handler, you shouldn't be calling it explicitly. You would just
subscribe it to the Click event on the Button control in question.
You can do this explicitly in your own code using the "+" operator on
the event:
Button btn = ...;
btn.Click += buttonRun_Click();
or even better, just use the VS Designer to hook it up by assigning it
in the properties inspector for the control (you'll have to click on
the lightning-bolt button to show the events for the control).
The former is significantly different from the VB paradigm, but the
latter should be basically the same AFAIK in either language (and will
auto-generate the appropriate code, whether you're writing VB or C#).
Pete