Hello,

Is it possible to call a button's click event from another procedure? If
so, what needs to be supplied as the Object , and SysEventArgs parameters for
the click procedure?

Thanks.

Re: call a button's click event from another procedure by Tim

Tim
Mon Jan 24 09:18:09 CST 2005

Just call the Button's PerformClick method.

--
Tim Wilson
.Net Compact Framework MVP

"Chris" <Chris@discussions.microsoft.com> wrote in message
news:951F9714-D442-4A7C-B66C-5029AF215847@microsoft.com...
> Hello,
>
> Is it possible to call a button's click event from another procedure? If
> so, what needs to be supplied as the Object , and SysEventArgs parameters
for
> the click procedure?
>
> Thanks.



Re: call a button's click event from another procedure by Chris

Chris
Mon Jan 24 09:29:35 CST 2005

It would be better to take the code that is in the button click event
handler and put it into a sub routine and then call that sub from both
places.


Re: call a button's click event from another procedure by Herfried

Herfried
Mon Jan 24 09:34:38 CST 2005

"Chris" <Chris@discussions.microsoft.com> schrieb:
> Is it possible to call a button's click event from another procedure? If
> so, what needs to be supplied as the Object , and SysEventArgs parameters
> for
> the click procedure?

If the button is visible and enabled, you can call its 'PerformClick'
method. Alterantively you can take the code from the event handler and put
it into a separate procedure. This procedure can be called from within the
event handler and other procedures.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>