Two events with one button??? (urgent)

Hi experts,

I need a button to handle two events, a click and mousehover.

I tried the following............

    Private Sub btnShowLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowLogin.Click

    Private Sub btnShowLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowLogin.MouseHover

.............but a blue line appears underneath btnShowLogin_Click with the following error: "Method 'btnShowLogin_Click' has multiple definitions with identical signatures"

How can a button have two events, i need the same button to respond to a click and mouse hover
ab2aeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Hi ab2ae,

  Private Sub btnShowLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowLogin.Click,btnShowLogin.MouseHover

You can assign multiple events to the same sub!

Tim Cottee
iboutchkineCommented:
here are the events defrnitions

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

    End Sub

    Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover

    End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ab2aeAuthor Commented:
with the click event i want a textbox to be shown and with a mousehover event i want a label to be shown.

This currently shows both with a mousehover or a click!!

How do i test for which event has been 'fired'
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

ab2aeAuthor Commented:
just read the post from iboutchkine, two separate events is what i want, prevents any if statements with only one event  having multiple even handlers!!

cheers guys
iboutchkineCommented:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
txt.visible = true
label.visible = false
    End Sub

    Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover
txt.visible = false
label.visible = true
    End Sub
ab2aeAuthor Commented:
Private Sub btnShowLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowLogin.Click
       
    Private Sub btnShowLogin_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShowLogin.MouseHover
     
    End Sub

this is what was i wanted, cheers
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.