views:

274

answers:

1

I have a user control with the following code in it.

[System.ComponentModel.Category("Appearance")]
public override string Text { ... }

private int myVar;
[System.ComponentModel.Category("Appearance")]
public int MyProperty { ... }

MyProperty shows up in the property grid when the control is inserted in a form, but Text does not. How can I get it visible?

+4  A: 

If you add the System.ComponentModel.Browsable(true) attribute to your property it should show up in the property browser. Using your example above I confirmed the behavior in VS2008.

Jim H.
Hm. I've tried this, and it still seems not to be working. I'll restart VS. *grumbles*
recursive
Sure enough, there it is.
recursive
I had trouble getting any property to show up but then I realized I was editing MyControl, not the MainForm in which I had placed. That is where the properties are changeable (duh!). Hope that helps anyone who reads this.
Jared Updike