Http://msdn.microsoft.com/zh-cn/library/hkkb40tf (vs.90). aspx
Updated: February 1, November 2007
Even if you do not click a button, you can use the javasmclick method to programmatically trigger the button click event. The following example shows how to call a button click event in a program. When you click button2, The Click Event of button1 is also triggered.
Use buttons in programs
On the File menu, click New project ".
In the "Create Project" dialog box, in the "template" pane, click "Windows Forms Application", and then click "OK ".
A new windows form project is opened immediately.
Drag two button controls from the toolbox to the form.
In the form, double-click the first button (button1) to create the click event handler.
In the button#click event handler, type the following code line.
MessageBox. Show ("button1.click was raised .");
Right-click the code and click View designer ".
Double-click the second button (button2) to create the click event handler.
In the button2_click event handler, type the following code line.
// Call the click event of button1.
Button1.w.mclick ();
Press F5 to run the program.
The program starts and a form is displayed. When you click button1 or button2, the click event handler of button1 displays a message.