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 / Managed C++ / September 2007

Tip: Looking for answers? Try searching our database.

Object sender, System.EventArgs e

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
J e r - 07 Sep 2007 16:49 GMT
I'm trying to call ButtonClick( object sender, System.EventArgs e) from a
method rather than clicking the button. But I can't determine the values of
sender and e that I should use. I ran the program with a stop on, clicked
the button and opened up a watch window and it shows them as
System.Windows.Forms.MenuItem and System.EventArgs with all their
attributes.

My question is how do I determine the proper values of sender and e that I
can use to call  ButtonClick(sender, e) ?

Thanks for your time, J e r
Ben Voigt [C++ MVP] - 10 Sep 2007 15:00 GMT
> I'm trying to call ButtonClick( object sender, System.EventArgs e) from a
> method rather than clicking the button. But I can't determine the values
[quoted text clipped - 6 lines]
> My question is how do I determine the proper values of sender and e that I
> can use to call  ButtonClick(sender, e) ?

In most cases:

ButtonClick(null, EventArgs.Empty)

will work just fine.  If you actually use the sender parameter inside the
handler, you'll have to either provide the right control or else write the
handler to check for null and then avoid using sender.

> Thanks for your time, J e r
Ben Voigt [C++ MVP] - 10 Sep 2007 15:00 GMT
> I'm trying to call ButtonClick( object sender, System.EventArgs e) from a
> method rather than clicking the button. But I can't determine the values
[quoted text clipped - 6 lines]
> My question is how do I determine the proper values of sender and e that I
> can use to call  ButtonClick(sender, e) ?

oops, this is C++/CLI group

that should have been nullptr and EventArgs::Empty

> Thanks for your time, J e r

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.