build propertygrid at runtime...

lidds

Junior Contributor
Joined
Nov 9, 2004
Messages
210
What I want to be able to do is add properties to my propertygrid at runtime depending on what properties the user has specified with a database table. Let me give you an example and hopefully it might all become clearer.

I have a propertygrid called 'propGrid1' which is placed on my form already at design time. I then have a database table which has 3 columns and info as shown below:

propertyName | propertyCategory | propertyType |
-----------------------------------------------------
textProp1 | textCate | text |
boolProp1 | booleanCate | boolean |

What I want to be able to do is read the contents of the table and in this case create 2 properties within my propertygrid (1) name = 'textProp1' which is in a propertygrid category called 'textCate' which allows text input (2) name='boolProp1' which is in a propertygrid category called 'booleanCate' and allows a 'true' or 'false' combobox.

I know how to hard code these properties in e.g.

<CategoryAttribute("textCate"), _
DescriptionAttribute("Hard coded text property")> _
Public Property textProp1() As String
Get
Return _textValue
End Get
Set(ByVal Value As String)
_textValue = Value
End Set
End Property

But I don't know how to create a property dynamically using information from a table. Does anyone have any idea on how I could do this, I am relatively new to vb.net so any type of example would be greatfull.

Thanks inadvance

Simon
 
Back
Top