Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

EventArgs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Dann - 26 Oct 2004 11:19 GMT
Sorry I've forgotten what parameter for EventArgs to pass to a button
click-handling event handler if I simply want to call it from code, ie

Button_click(Me, ???)

(I presume that it is acceptable practice to call the click handler
directly from other code? The other option could be to place the click
handler code in a separate subroutine (ClickHandler) which could be
called both from the click handling event procedure and also from
anywhere else that it might be relevant without worrying about the
event arguments. But OTOH introducing unnecessary 'nesting' makes the
code less readable overall.)

JGD
Herfried K. Wagner [MVP] - 26 Oct 2004 12:56 GMT
"John Dann" <news@prodata.co.uk> schrieb:
> Sorry I've forgotten what parameter for EventArgs to pass to
> a button click-handling event handler if I simply want to call
> it from code, ie
>
> Button_click(Me, ???)

'EventArgs.Empty'.  But I prefer calling the button's 'PerformClick' method
(which will only fire the event if the button is visible and enabled).

> directly from other code? The other option could be to place the click
> handler code in a separate subroutine (ClickHandler) which could be
> called both from the click handling event procedure and also from
> anywhere else that it might be relevant without worrying about the
> event arguments.

That's IMO the preferred way.

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.