Hi Wilson,
The PropertyGrid is used to show the properties of a class. Your example does not have any properties. Keep in mind that the PropertyGrid only displays properties that are public. Here is an example:
Public Class MyClass
Private theString As String
Public Property Get Title As String
Return theString
End Property
Public Property Set Title(value As String)
theString = value
End Property
End Class
Now, put a PropertyGrid on the form. In the form_load event, do the following:
PropertyGrid1.SelectedObject = New MyClass()
The grid should browse your class.
>Is there a way to add an instance of a class to a PropertyGrid, for example:
>
>i create this class
>
>public class myclass
> public x as integer
>end class
>
>I create an instance of this class and add it to the propertygrid selectedobject, but it does not work.
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi