|  | 
| AddChildItemBinded & ReadOnly Properties | 
| Post Reply   | 
| Author | |||
| ianp   Moderator Group     Joined: 19 December 2003 Location: United Kingdom Status: Offline Points: 119 |  Post Options  Thanks(0)  Quote  Reply  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: 
 
 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: 
 
 However, when I do this, I get the following run-time error: 
 
 Any ideas what I'm doing wrong? | |||
|  | |||
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  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 | |||
|  | |||
| ianp   Moderator Group     Joined: 19 December 2003 Location: United Kingdom Status: Offline Points: 119 |  Post Options  Thanks(0)  Quote  Reply  Posted: 05 February 2006 at 7:50am | ||
| Hi Oleg 
 
 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) 
 
 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? | |||
|  | |||
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  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 | |||
|  | |||
| Post Reply   | |
| Tweet | 
| Forum Jump | Forum Permissions  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |