Solved

Addhandler directcast

Posted on 2016-08-23
2
22 Views
Last Modified: 2016-08-23
Hello,

Any suggestions on how can I use a addhandler directcast for the below repetitive code .

Private Sub DgClinic_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DgClinic.CellMouseClick
        CellMouseClick(sender, e)
    End Sub
    Private Sub DgCorr_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DgCorr.CellMouseClick
        CellMouseClick(sender, e)
    End Sub
    Private Sub DgDiary_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DgDiary.CellMouseClick
        CellMouseClick(sender, e)
    End Sub
    Private Sub DgContactdir_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DgContactsDir.CellMouseClick
        CellMouseClick(sender, e)
    End Sub
    Private Sub DgContactsIntDir_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DgContactsIntDir.CellMouseClick
        CellMouseClick(sender, e)
    End Sub


Cheers
0
Comment
Question by:RIAS
2 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41766865
you can add multiple control to the Handles clause:

Private Sub CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DgClinic.CellMouseClick, DgCorr.CellMouseClick, DgDiary.CellMouseClick, DgContactsDir.CellMouseClick, DgContactsIntDir.CellMouseClick
        CellMouseClick(sender, e)
    End Sub

Open in new window

1
 

Author Closing Comment

by:RIAS
ID: 41766898
Cheers!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now