Solved

Addhandler directcast

Posted on 2016-08-23
2
27 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vb.net dynamic formulas in runtime 11 61
Export import database 4 40
fso.FolderExists("\\server\HiddenFolder$") 4 46
C# HTTP GET method sample code 3 37
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 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

14 Experts available now in Live!

Get 1:1 Help Now