You can wire both click events to one procedure or not, but I would separate
out your logic from the button event itself. The benefit to this is that
you can call DoSomething from anywhere (not just these events).
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
DoSomething
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
DoSomething
End Sub
or simply....
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click, Button2.Click
DoSomething
End Sub
Private Sub DoSomething()
msgbox("Hello World")
End Sub
HTH,
Greg
"Will" <Wi**@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.com...
i dont think you guys understood me ... what i mean is if i click
cmdButton1, a message pops up ("Hello World") ..
no if i try to call the me.cmdButton1_click event in cmdButton2,
me.cmdbutton1_click(Sender as Object,e as System.eventArgs) how do i use
Sender as Object and the e as System.eventArgs ? what do they mean ?
THANX IN ADVANCE GUYS
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?V2lsbA==?=" <Wi**@discussions.microsoft.com> scripsit: quick question ... i have two buttons (cmdButton1, cmdButton2) ....
how do i use the click event in cmdButton1 from cmdButton2 ?
for example .. if you click cmdButton1 .. a massage box pops up saying
"hello world" .. i wont to pop up this message box by click on cmdButton2 ..
I am not sure if I understand your question. Do you want to create a
'Click' event handler that is used by both buttons?
\\\
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click, Button2.Click ...
End Sub
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>