0

hello!
i need help with mouse click.
i need to place in a timer_tick a code that detect if i clicked with the mouse.
so i know that i can use on mouse click event ,but i have many and many controls so it's take a lot of time and code so simply and for me it's the hard thing,i want to detect if the mouse had been clicked or not.
so thank you for help!:)

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by codeorder
0

Hi,

You doesn't need a timer for this.
Here's an example:

Private Sub Form1_Mousedown(ByVal sender As System.Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
MsgBox(" You clicked the Left mousebutton")
End If
End Sub
0

yes thank you but i want to explain my situation:
i have a custom control that merge 2 controls which i play with the visibility ,so i want to handle the mouse click not in the form because the custom control it's like a form so i need the mouse click outside this "form".
thank you. :)

0
Private mouse_Click As Integer = 0 '// keep track of clicks.

    Private Sub Button1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
        Handles Button1.MouseClick, Button2.MouseClick, ListBox1.MouseClick, TextBox1.MouseClick, TextBox2.MouseClick, _
         TextBox3.MouseClick
        mouse_Click += 1 '// increase count by 1.
        Me.Text = mouse_Click
    End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.