Another Hidden Jewel--System.Windows.Forms.PropertyGrid

I was just writing my 10-millionth option settings dialog for a WinForm application when I discovered the wonderous PropertyGrid. We've all used this control within Visual Studio to set the properties of controls and other aspects of our project. I just didn't know it was a control we could add to our toolbox and, voila-instant object property settings--presented in a very consistant manner.

The key method of the PropertyGrid class is SelectedObject, which sets the object for which you wish to view/set its properties. A great little sample is a hello-world WinForm application that contains the PropertyGrid in the main form. Set the grid's SelectedObjet=this (the form itself) and you see all of the forms public properties. Be careful not to set Enabled=false--you'll be unable to continue since your main form is no longer enabled.

I don't remember discovering so many useful widgets when I worked with MFC/C++ for so many years--another testimony to the richness of the Framework classes.

Published Thursday, April 03, 2003 8:40 AM by shark

Comments

# propertygrid, the hidden jewel : Andy Smith's Blog

Thursday, April 03, 2003 11:40 AM by TrackBack
propertygrid, the hidden jewel : Andy Smith's Blog

# re: Another Hidden Jewel--System.Windows.Forms.PropertyGrid

Tuesday, April 26, 2011 7:17 PM by Bella Simpson

It was certainly interesting for me to read the article. Thanx for it. I like such themes and anything connected to this matter. I would like to read more soon.  

Bella Simpson    

<a href="www.pickescort.com/">London massage escort</a>

Leave a Comment

(required) 
(required) 
(optional)
(required)