Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

reflections

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Perecli Manole - 13 Apr 2007 02:00 GMT
Is there a way to reflect the events in a class that are declared as
"Friend"?

Dim objEventDescriptors As EventDescriptorCollection =
TypeDescriptor.GetEvents(Me, New Attribute() {New
ScriptEventAttribute(True)})
For Each objEventDesc As EventDescriptor In objEventDescriptors
   'do stuff
Next

The above code works only for "Public" events but I want to get the events
that are declared with "Friend" access. I am running this code from the
local DLL so it has access to "Friend" events.

Perry
Oliver Sturm [MVP C#] - 20 Apr 2007 18:01 GMT
Hi,

> Is there a way to reflect the events in a class that are declared as
> "Friend"?

I think this is not possible using the TypeDescriptor.GetEvents() method.
But you should be able to do it using Type.GetEvents() instead, passing in
(amongst others) BindingFlags.NonPublic. Here's the MSDN page explaining
that method - I can't currently try it out because I'm reinstalling some
things here and VS is not running. Let me know if you can't get it to work
and I'll have another look later.

              Oliver Sturm
Signature

http://www.sturmnet.org/blog - MVP C#


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.