How to hide a object's inherited properties ?

I create a user control object and show its properties through a propertygrid object in my application. It is sure that there are 100 hundred of properties inherited from System.Windows.Forms.UserControl and they are all showd on the propertygrid object. Is there a way i can hide all these inherited properties and show only my user control's properties ?
mrvithanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tomvergoteCommented:
uh, you could sorta shadow methods or override them, but you'll have to go through all 100 properties

look here:
http://www.developerfusion.com/show/3821/9/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrvithanAuthor Commented:
- -'' you mean I have to do kind of

[BrowsableAttribute (False)]
public override xxxx ()
{
     base.xxx ();
}

for all of the inherited properties ?  T_T
0
tomvergoteCommented:
yup, as far as i know at least
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

mrvithanAuthor Commented:
- -'' .... ok i think i will wait more ..... ^^''
0
tomvergoteCommented:
I think it's pointless, thats the purpose of inheriting from something, you inherit all its properties, unless you override them
0
NipNFriar_TuckCommented:
You could use a custom attribute and then in your properties page only display those properties with the custom attribute... Basically you create a class that inherits from attribute:

public class ShowMyProperty : Attribute {
}

Then when everyou want to display a property in your form you would do something like:

[ShowMyProperty]
public string MyString {
   get { return myString; }
   set { myString = value; }
}

Then when you are building your properties page you get the property info...
PropertyInfo[] piArray = myClass.GetProperties();

Then go through the properties...
foreach ( PropertyInfo pi in piArray ) {
   ShowMyProperty[] smp = (ShowMyProperty[])pi.GetCustomAttributes( typeof( ShowMyProperty ) );
   if ( smp != null ) {
      // perfrom action for property to be displayed
   }
}


HTH
0
mrvithanAuthor Commented:
One again that i can't get the right solution for a not-in-a-book question.

To tomvergote, your solution is a way to do. but override 100 properties is not a clever way, especially when you don't know how it does.

I will post here what i think it is the best solution: http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.framework.windowsforms&mid=05525833-418c-44e7-a2d5-f39a07743c82

However, the point is MUST give, therefore 250 point will go with your. ^^''
0
tomvergoteCommented:
No the points are not a must give, you can post a request for refund, check the help button on your upper right corner.
http://www.experts-exchange.com/help.jsp#hi70
I answered my question myself. What do I do?

Post a question in the Community Support topic area asking for a refund, and asking the Moderators to close the question. You'll be required to post your solution in your original question. A Moderator will post a notice of your request which will give the participants 96 hours to object to the refund. Note that if it resembles one of the suggested comments, the likelihood is that your request will not be granted, but rather, the points will be awarded to the Expert who makes the suggestion. In your Community Support request, remember to post a link to the original question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.