How can I call this function from another button click?

T

Trint Smith

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Is it like Button1.Click()?
thanks,
Trint

..Net programmer
(e-mail address removed)
 
T

Tom Shelton

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Is it like Button1.Click()?
thanks,
Trint

.Net programmer
(e-mail address removed)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click, Button2.Click
....
End Sub

or...

Button1.PerformClick()

or...

Me.Button1_Click(Button1, New EventArgs())

HTH
 
H

Herfried K. Wagner [MVP]

* Trint Smith said:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Is it like Button1.Click()?

'Button1.PerformClick', but I recommend putting the code from the
handler to a separate procedure and call this procedure directly (and
from the handler too).
 
C

CJ Taylor

Is it like Button1.Click()?
'Button1.PerformClick', but I recommend putting the code from the
handler to a separate procedure and call this procedure directly (and
from the handler too).

Hmm... Never knew about that one... could see advantages. =)
 
T

Trint Smith

This didn't work...but I found cor's answer that did on google:

http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=25f701c
3a94d%24926b7e40%24a601280a%40phx.gbl&rnum=1&prev=/groups%3Fq%3Dweb%2B%2
522PerformClick%2522%2Bgroup:microsoft.public.dotnet.languages.vb%26hl%3
Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D25f701c3a94d%2524926b7e40
%2524a601280a%2540phx.gbl%26rnum%3D1

Thanks,
Trint

.Net programmer
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top