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 / .NET Framework / General / October 2004

Tip: Looking for answers? Try searching our database.

How can I call an event procedure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roger - 26 Oct 2004 21:01 GMT
Hi All,
I need to call a text box click event programatically. How would I call the
following event procedure from another procedure within the same form:

Private Sub TextBox2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox2.Click

Thanks in advance.
Roger.
Morten Wennevik - 26 Oct 2004 21:54 GMT
Hi Roger,

If you don't use 'sender' or 'e' you can simply do

TextBox2_Click(null, null)

Alternately you can do TextBox2_Click(this, new EventArgs()); // C#

Signature

Happy Coding!
Morten Wennevik [C# MVP]

Roger - 26 Oct 2004 22:21 GMT
Thanks for your help.
VS.net 2003 said that null is not supported but (this, new eventargs())
works fine.

Thanks again.
Roger.

> Hi Roger,
>
[quoted text clipped - 3 lines]
>
> Alternately you can do TextBox2_Click(this, new EventArgs()); // C#
Chris Dunaway - 26 Oct 2004 22:10 GMT
> Hi All,
> I need to call a text box click event programatically. How would I call the
[quoted text clipped - 5 lines]
> Thanks in advance.
> Roger.

The best way is to put the code you need to execute in a separate sub and
then call that sub from both places.

Signature

Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.


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.