Not a problem at all. Best of luck to you.
--
Kyril Magnos
"Özden Irmak" <ozdenirmakatisnetdotnetdottr> wrote in message
| Dear Kyril,
|
| Thank you for your great effort on solving my problem...
|
| Normally I don't care whether the events will work or not but it was
| essential for me to hide the events as those events normally doesn't have
| anything to do with my control, in a correct way, my control is for a
| specific purpose and I didn't want to make it available for a generic
usage
| (Some technical and commercial reasons lies on this) so I wanted to hide
the
| events...
|
| Anyway, if we can't do it, nothing else can be done...
|
| I again want to thank you for your personal attention...
|
| Best Wishes,
|
| Özden Irmak
|
| | > Hi Özden,
| >
| > I did some research and came up with this. The BackColorChanged event is
| > inherited from UserControl and as such cannot be hidden from the code
| > internally in C#. One of the facts of life and inheritance. Now, while
you
| > can hide it from the PropertyGrid by using Attributes, you will not be
| able
| > to hide it from code. Unfortunately, VB and C# do inheritance a bit
| > differently. The Shadows keyword in VB allows you to hide a base class
| > member by defining a new member that can have a different access level,
| > return type, and parameter signature. In other words, only the name
| remains
| > the same but the member itself may be completely different. Base class
| > members hidden in C# using the "new" keyword can only redefine their
| access
| > level and return type. The parameter signature must remain the same, or
| the
| > method is treated as an overload. This is why you cannot hide it
| completely
| > from code. But, I have a solution for you. While you cannot hide it, you
| can
| > override the OnBackColorChanged() method like so:
| >
| > protected override void OnBackColorChanged(EventArgs e)
| > {
| > base.OnBackColorChanged (e);
| > throw new NotImplementedException("This event is unavailable");
| > //I just put this in, you can put whatever you want here...
| > }
| >
| > So that even if the consumer registers for the event, they will not be
| able
| > to anything with it.
| > --
| > HTH
| >
| > Kyril Magnos
| > "I'm not a developer anymore, I'm a software engineer now!"

| >
| > "Özden Irmak" <ozdenirmakatisnetdotnetdottr> wrote in message
| > | > |I know that "new" keyword is the equal/nearest functional in C# for
| > | "Shadows" in VB.Net but I couldn't get it work like in "Shadows"...
| > |
| > | I've attached two sample "usercontrol" files...In VB.Net, I can hide
| > | "BackColorChanged" with "Shadows" but in C#, even it hides it from the
| > | PropertyGrid, I can still see/reach it via code after I use "new"...
| > |
| > | Any help will be appreciated...
| > |
| > | Özden
| > |
| > | | > | > Yes, the new keyword is the equivalent of Shadows in VB.NET.
| > | >
| > | > --
| > | > HTH
| > | >
| > | > Kyril Magnos
| > | > "I'm not a developer anymore, I'm a software engineer now!"

| > | >
| > | > "Christoffer Skjoldborg" <firstnameATlastnameDOT.biz> wrote in
message
| > | > | > | > |I think "new" in C# is the equivivalent of "Shadows" in VB.
| > | > |
| > | > | /Chris
| > | > |
| > | > |
| > | > |
| > | > |
| > | > | "Özden Irmak" <ozdenirmakatisnetdotnetdottr> wrote in message
| > | > | | > | > | > Hi,
| > | > | >
| > | > | > I'm trying to hide an event of my custom usercontrol derived
| > control,
| > | > | > something like "Shadows" in VB.Net, but although the event is
| hidden
| > | > from
| > | > | > PropertyGrid, from CodeEditor I can still see/reach it. I use
this
| > | code
| > | > :
| > | > | >
| > | > | > [EditorBrowsable(EditorBrowsableState.Never)]
| > | > | >
| > | > | > [Browsable(false)]
| > | > | >
| > | > | > new public event EventHandler BackColorChanged;
| > | > | >
| > | > | > Does anybody knows a solution for this?
| > | > | >
| > | > | > Thanks in advance,
| > | > | >
| > | > | > Özden
| > | > | >
| > | > | >
| > | > |
| > | > |
| > | >
| > | >
| > |
| > |
| > |
| >
| >
|
|