Asks the container if a property bound to a data source can have its value changed. The CanPropertyChange method is most useful if the property specified in PropertyName is bound to a data source.
Syntax
object.CanPropertyChange PropertyName
The CanPropertyChange method syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
PropertyName | A string expression that represents a name of the property that the control is requesting to change. |
Return values
The possible return values for CanPropertyChange are:
Setting | Description |
True | The property specified in PropertyName can be changed at this time. |
False | The property specified in PropertyName cannot be changed at this time; the container has the bound data table open as read only. Do not set the property value; doing so may cause errors in some control containers. |
Remarks
The control should always call CanPropertyChange before changing the value of a property that can be data-bound.
Note At present, CanPropertyChange always returns True in Visual Basic, even if the bound field is read-only in the data source. Visual Basic doesn’t raise an error when the control attempts to change a read-only field; it just doesn’t update the data source.
As an example, the following code shows how the CanPropertyChange method is used:
Public Property Let Address(ByVal cValue As String)
If CanPropertyChange("Address") Then
m_Address = cValue
PropertyChanged "Address"
End If
End Property