using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
...{
protected void Button1_Click(object sender, EventArgs e)
...{
Response.Write("這是Button1觸發的事件");
}
protected void Button2_Click(object sender, EventArgs e)
...{
Button1_Click(null, System.EventArgs.Empty);//調用Button1單擊事件
}
}
下面是調用其他類型事件的例子(VB的),摘自CSDN
2 樓Snakeguo(Guoguo)回復於
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
showmessage(''enter'');
end;
procedure TForm1.Button2Click(Sender: TObject);
var
k: char;
begin
k := ''a'';
Edit1KeyPress(Sender, k);
end;
*/