Skip to content

AddChildItemBinded Method

See Also

Description

Adds a child item that is bound to the PropertyGridItem. This means that the PropertyGridItem is bound to a variable, and the value of the item is stored in this variable.

Syntax

Public Function AddChildItemBinded( _
    ByVal [Type](#) As [PropertyItemType](XtremePropertyGrid~Enumerations~PropertyItemType_EN.md), _
    ByVal [Handler](#) As Object, _
    ByVal [Property](#) As String _
) As [PropertyGridItem](XtremePropertyGrid~PropertyGridItem.md)

Parameters

Remarks

Bound variables store the values of the property grid items and can be accessed without using the property grid methods and properties. Bound variables allow the property grid to store data in variables. Binding works in only one direction. When the value of a PropertyGridItem is changed, the value of the bound variable will be changed to the PropertyGridItem value. If the value of the variable is changed without using the PropertyGrid, the PropertyGridItem value will not change (you would need to explicitly update the PropertyGridItem value with the contents of the variable). The advantage of binding is that the variable can be used and manipulated without using PropertyGridItem methods and properties.

Important Note: When the binding occurs, the variable name is passed to the method in String Notation. String Notation means the name of the variable is placed in quotation marks, and within the quotation marks, the variable name can be passed with any combination of spaces and uppercase/lowercase letters, but no extra characters can be added, and they must appear in the same order. For example, when binding to the variable AssembleName, you could pass the variable as Sassemblename, which is the same as SASSEMBLE n a m e, but SAssemble Names will not work because an extra S is added. The reason for this is that the variable name passed in String Notation will be used as the PropertyGridItem Caption if no caption is explicitly set.

Note: A variable must be declared within an object's code if it will be bound. This means bound variables cannot be declared in a .bas module.

Example

This sample illustrates how to use the AddChildItemBinded method to bind PropertyGridItems to variables.

Dim Category As PropertyGridItem, ItemAssemble As PropertyGridItem  
Dim AssembleName As String  

' Variable that the PropertyGridItem will be bound to  
AssembleName = "WindowsApplication1"  

' Category named "Application" is added to the collection of categories of the first property grid  
Set Category = wndPropertyGrid(0).AddCategory("Application")  

' Adds a child property item bound to the variable AssembleName. This child is added to  
' the "Application" category's collection of children  
Set ItemAssemble = Category.AddChildItemBinded(PropertyItemString, Me, "AssembleName")  

' Change the caption of the property item or the default will be used. The default caption  
' that will be used is the name of the bound variable  
ItemAssemble.Caption = "Name of Application"

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.