|
-
Sep 17th, 2009, 01:54 AM
#1
Thread Starter
Addicted Member
detecting mouse clicks in a control
Hi folks, I am a VB newbie, trying to learn VB with the basic online tutorial that came with VB 2008 Express.
I would like the text in a button to display "hello" when it is first clicked, and "world" when it is clicked again. But I don't know how to write code to detect the second click.
I've used the forum search to find threads with "mouse clicks" in the topic, and have read at least a dozen of them, but they do not help.
Thanks in advance. 
==========================================================
Private Sub StartStopButton_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles StartStopButton.MouseClick
Button1.Text = "Hello"
Button1.Text = "world"
End Sub
=========================================================
-
Sep 17th, 2009, 02:04 AM
#2
Re: detecting mouse clicks in a control
You need a member variable, i.e. declared at the class level, to store a value that indicates what click you're on. You can then the current value of that variable to decide what to do on the current click, then set it for the next click.
-
Sep 17th, 2009, 02:16 AM
#3
Thread Starter
Addicted Member
Re: detecting mouse clicks in a control
Thanks jmcilhinney
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|