• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2559
  • Last Modified:

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

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.


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


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


Errors:
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'

0
wenyonk
Asked:
wenyonk
  • 2
  • 2
1 Solution
 
Expert1701Commented:
wenyonk, would you give the following a try?

  copiedData.Add(new TestDataSource(dataSource.DataSource.CopyAll(new System.EventHandler(Security.HasAccess), recordType, locationID, accessType)));
0
 
Bob LearnedCommented:
System.EventHandler has the signature (object sender, System.EventArgs e)

Bob
0
 
Expert1701Commented:
Sorry, what I should have said was:

  copiedData.Add(new TestDataSource(dataSource.DataSource.CopyAll(new App.UsersAndSecurity.CheckPermission(Security.HasAccess), recordType, locationID, accessType)));
0
 
Bob LearnedCommented:
You know what might prove to be useful, if that was not an answer--a better description of the problem space.

Bob
0
 
wenyonkAuthor Commented:
this answer seemed to compile, I'll have to do testing...

Thank you!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now