[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Two events with one button??? (urgent)

Posted on 2006-04-05
6
Medium Priority
?
235 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:ab2ae
  • 3
  • 2
6 Comments
 
LVL 43

Assisted Solution

by:TimCottee
TimCottee earned 600 total points
ID: 16380342
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
0
 
LVL 28

Accepted Solution

by:
iboutchkine earned 1400 total points
ID: 16380353
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
0
 

Author Comment

by:ab2ae
ID: 16380368
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'
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:ab2ae
ID: 16380383
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
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 16380387
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
0
 

Author Comment

by:ab2ae
ID: 16380392
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
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question