Loading event code manually

  • Thread starter Thread starter VM
  • Start date Start date
V

VM

How can I manually run the code of an event? For example, I want to run a
Mouse click event without actually clicking doing a Mouse click?
Thanks.
 
Hi VM,
In the InitializeComponent() method, you can see the control's
event is bind to a method.(by delegate)
You can directly invoke the method to trigger this event.

For example, if you want to trigger the Form_Load event, in Button_click
event, you can invoke like this:

this.Form1_Load (sender,e);

HTH.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "VM" <None>
| Subject: Loading event code manually
| Date: Fri, 15 Aug 2003 17:09:28 -0500
| Lines: 5
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 66-50-71-98.prtc.net 66.50.71.98
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:176883
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| How can I manually run the code of an event? For example, I want to run a
| Mouse click event without actually clicking doing a Mouse click?
| Thanks.
|
|
|
 
Back
Top