Propert Grid in the 2.0 Framework
Like a whole lot of other things in the 2.0 Framework, stuff that used to be a pain in the a55 got a whole lot simpler. Using the PropertyGrid control is probably on of the easiest of them. Basically, if you want to provide a clean and easy way for people to edit properties of your objects, all you need to do is drag one of these bad boys on a form and then set the SelectedObject property to your object. Every public property that isn't otherwise marked is browsable. If there's a get and set accessor, you can set the properties in addition to viewing them. If you only have get accessors, then the property will be disabled in the PropertyGrid. To let the user select a control, I used the following snippet (couldn't be easier). The main reason I built this thing was that I was debugging some code and I kept forgetting to set properties that I needed. I ended up doing it in the debug window but that leaves a little to be desired w/ screen refreshes and all. For the sake of illustration, I have the property grid show from behind a button click, but what I actually implemented was this via a ContextMenue. However you implement it, it's easy as h3ll.
foreach (Control ctrl in this.Controls)
{
this.listBox1.Items.Add(ctrl.Name);
}
So to make things easy, I just created a Form, dropped a PropertyGrid onto it, set the Dock property to full, and viola.

Again, this is totally simple but it's pretty cool for editing your objects. Note that in the listbox, I listed only controls on the form - but I could just as easily have loaded configuration values, other controls, or any other object that I so desired. All that I do is create an overloaded constructor and set the SelectedObject property to whateverI pass in . Since you can pass in ANY object, you have tremendous flexibility:
public
Form2(object o)
{
InitializeComponent();
this.propertyGrid1.SelectedObject = o;
}