Results 1 to 2 of 2

Thread: click on any object in the app

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Porto Alegre, RS
    Posts
    210

    click on any object in the app

    how can i handle the mouse button on my form, wherever the user clicks??

    like one command to all itens of the screen!!!


    Thank you,
    Guilherme Costa

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    You could loop through every control on the form and attempt to add an OnClick handler.

    VB Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.  
    3.         For Each c As Control In Controls
    4.             Try
    5.                 AddHandler c.Click, New EventHandler(AddressOf GenericClickHandler)
    6.             Catch
    7.             End Try
    8.         Next
    9.  
    10.     End Sub
    11.  
    12.     Private Sub GenericClickHandler(ByVal sender As Object, ByVal args As System.EventArgs)
    13.         MsgBox(sender.name)
    14.     End Sub

    Something like that.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width