How can I call an event procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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#
 
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.

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

--
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.
 
Thanks for your help.
VS.net 2003 said that null is not supported but (this, new eventargs())
works fine.

Thanks again.
Roger.
 
Back
Top