?
Solved

Addhandler directcast

Posted on 2016-08-23
2
Medium Priority
?
51 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 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