Customizing the Propertygrid control

D

Dave

Hi!

I am writing an application that needs to provide a way for users to query a
database, by filling out a form of fields and values - i.e. QBE (Query By
Example).

I'm playing with different ideas as to how to best provide a UI to do this.
The main idea I'm working with now is to use the .NET PropertyGrid control.
It would contain the different fields that people could query on, and people
could fill out the value column with the values they want to query. There's
a lot to like about PropertyGrid for what I'm trying to do. It would
support complex values, with more than one "property" as part of a single
value. It would support editing of values of different data types. It
allows for grouping properties together. Etc.

My question is - is this reasonable to attempt? The problem is that I don't
really have an object whose "properties" are being edited by the
PropertyGrid control. Rather, I want to be able to dynamically,
programatically, populate the propertygrid control myself. I like the UI of
the PropertyGrid control, but I'm not sure if I'm shoehorning it to provide
functionality that's so different from what it was intended for, that it
isn't worth doing.

Does this seem reasonable? If so, can anyone point me to some sample code
for filling out a PropertyGrid programatically? If not, does anyone have
any better suggestions for providing a QBE UI?

Thanks!

- Dave
 
T

Tom Krueger [MSFT]

Hi Dave,

The property grid is a great control and easy to use. Basically you create
a class the public properites and assign an instance of the class to the
SelectedObject property of the property grid control. You can further
customize the grid by setting attributes on the properites of your class.
Check out this article for more details
http://www.c-sharpcorner.com/Code/2004/June/PropertyGridInCSharp.asp

I wish I could help answer whether I think this will work for your
particular design, however, I'm not sure what exactly your needs are.
Forinstance, what are the complex values you need to set.

Hope this helps,

Tom Krueger

Smart Client DevCenter - http://msdn.microsoft.com/smartclient/
Mobile DevCenter - http://msdn.microsoft.com/mobility


This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top