No overload for 'HasAccess' matches delegate 'System.EventHandler'

Posted on 2006-05-05
Last Modified: 2012-08-13
Can someone please help with this line of code conversion from VB to C#?  Below is the original code, my attempt, and the compile errors.

copiedData.Add(New TestDataSource(dataSource.DataSource.CopyAll(AddressOf Security.HasAccess, recordType, locationID, accessType)))

copiedData.Add(new TestDataSource(dataSource.DataSource.CopyAll(new System.EventHandler(Security.HasAccess, recordType, locationID, accessType))));

No overload for 'HasAccess' matches delegate 'System.EventHandler'

The best overloaded method match for 'App.ICAEditable.CopyAll(App.UsersAndSecurity.CheckPermission, App.RecordTypeEnum, int, App.AccessTypeEnum)' has some invalid arguments

Argument '1': cannot convert from 'System.EventHandler' to 'App.UsersAndSecurity.CheckPermission'

Question by:wenyonk
    LVL 11

    Expert Comment

    wenyonk, would you give the following a try?

      copiedData.Add(new TestDataSource(dataSource.DataSource.CopyAll(new System.EventHandler(Security.HasAccess), recordType, locationID, accessType)));
    LVL 96

    Expert Comment

    by:Bob Learned
    System.EventHandler has the signature (object sender, System.EventArgs e)

    LVL 11

    Accepted Solution

    Sorry, what I should have said was:

      copiedData.Add(new TestDataSource(dataSource.DataSource.CopyAll(new App.UsersAndSecurity.CheckPermission(Security.HasAccess), recordType, locationID, accessType)));
    LVL 96

    Expert Comment

    by:Bob Learned
    You know what might prove to be useful, if that was not an answer--a better description of the problem space.


    Author Comment

    this answer seemed to compile, I'll have to do testing...

    Thank you!

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Article by: Ivo
    C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    732 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

    17 Experts available now in Live!

    Get 1:1 Help Now