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.