Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - AddChildItemBinded & ReadOnly Properties
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

AddChildItemBinded & ReadOnly Properties

 Post Reply Post Reply
Author
Message
ianp View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 19 December 2003
Location: United Kingdom
Status: Offline
Points: 119
Post Options Post Options   Thanks (0) Thanks(0)   Quote ianp Quote  Post ReplyReply Direct Link To This Post Topic: AddChildItemBinded & ReadOnly Properties
    Posted: 03 February 2006 at 11:39pm

I'm having difficulty updating the value displayed by a propertygrid item which is bound to a readonly property.

Here is the code I used to add the bound item:

Set xpgItem = xpgCategory.AddChildItemBinded(PropertyItemNumber, oItems, "Count")
xpgItem.ReadOnly = True

If the value of oItems.Count subsequently changes, I need the PropertyGrid to display the new value, so (as per the documentation) I explicitly update the PropertyGridItem value with the contents of the variable:

wndPropertyGrid.FindItem("Count").Value = oItems.Count

However, when I do this, I get the following run-time error:

Quote Run-time error '451':

Property let procedure not defined and property get procedure did not return an object

Any ideas what I'm doing wrong?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2006 at 8:27am

Check that wndPropertyGrid.FindItem("Count") returns some object and not "Nothing".

 

If you don't set xpgItem.ReadOnly = True do you have this error?

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
ianp View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 19 December 2003
Location: United Kingdom
Status: Offline
Points: 119
Post Options Post Options   Thanks (0) Thanks(0)   Quote ianp Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2006 at 7:50am

Hi Oleg

TypeName(wndPropertyGrid.FindItem("Count")) = IPropertyGridItem
wndPropertyGrid.FindItem("Count").value = 1
oItems.Count = 2
TypeName(oItems) = clsItems

If I don't set the ReadOnly flag on the PropertyGridItem, then I get the same error when programmatically setting the value, or by typing the new value into the propertygrid using the keyboard.

The error message that appears is technically correct. oItems.Count is a Property, of type Long, defined with a Get and no Let or Set. (i.e. the Count property is a read only value which is set based on other properties within the oItems object)

Private colItems As Collection
Public Property Get Code() As Long
    If Not colItems Is Nothing Then
        Count= colItems.Count
    Else
        Counts= 0
    End If
End Property

Any other ideas, or should I just revert to a regular child item as I am only displaying this value for informational purposes and have no real need for this property to be bound?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2006 at 10:00am
Think the problem that you bind the item to non "Long" property. Instead AddChildItemBinded use AddChildItem.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.