Home All Groups Group Topic Archive Search About

Hidden form and button PerformClick

Author
19 Oct 2006 6:06 PM
stevenhaochen@hotmail.com
Form.Visible=False
Button1.PerformClick

It does not fire the Button1.Click event.
Why?

Author
19 Oct 2006 6:42 PM
rowe_newsgroups
Don't know. But why not just call the procedure that handles the click
directly?

i.e.

<pseudocode>

Form.Visible = False
Button1_Click(me, eventargs.empty)

</pseodocode>

Thanks,

Seth Rowe


stevenhaoc***@hotmail.com wrote:
Show quoteHide quote
> Form.Visible=False
> Button1.PerformClick
>
> It does not fire the Button1.Click event.
> Why?
Author
22 Oct 2006 3:34 AM
Jay B. Harlow
Seth,
> Don't know. But why not just call the procedure that handles the click
> directly?
One of the biggest reasons I don't call & don't recommend calling the
procedure directly is that there may be multiple handlers for the event.

By calling the handlers directly you are coupling that code to the handlers
themselves. By calling PerformClick you are only coupled to the button
itself. The number of handlers is immaterial...


--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


Show quoteHide quote
"rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message
news:1161283342.869749.231940@k70g2000cwa.googlegroups.com...
> Don't know. But why not just call the procedure that handles the click
> directly?
>
> i.e.
>
> <pseudocode>
>
> Form.Visible = False
> Button1_Click(me, eventargs.empty)
>
> </pseodocode>
>
> Thanks,
>
> Seth Rowe
>
>
> stevenhaoc***@hotmail.com wrote:
>> Form.Visible=False
>> Button1.PerformClick
>>
>> It does not fire the Button1.Click event.
>> Why?
>
Author
19 Oct 2006 6:48 PM
zacks
stevenhaoc***@hotmail.com wrote:
> Form.Visible=False
> Button1.PerformClick
>
> It does not fire the Button1.Click event.
> Why?

Does it work if you leave the form visible?
Author
23 Oct 2006 1:34 PM
stevenhaochen@hotmail.com
Yes. It work if the form visible.

za***@construction-imaging.com 写道:

Show quoteHide quote
> stevenhaoc***@hotmail.com wrote:
> > Form.Visible=False
> > Button1.PerformClick
> >
> > It does not fire the Button1.Click event.
> > Why?
>
> Does it work if you leave the form visible?
Author
19 Oct 2006 9:35 PM
Herfried K. Wagner [MVP]
<stevenhaoc***@hotmail.com> schrieb:
> Form.Visible=False
> Button1.PerformClick
>
> It does not fire the Button1.Click event.
> Why?

Read the documentation on 'Button.PerformClick'!

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