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
=========================================================
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.
Re: detecting mouse clicks in a control