Data Property (Read Only)

NI DataSocket

Data Property (Read Only)

Syntax

CWDataSocket.Data

Data Type

CWData

Purpose

Specifies the current value and attributes that the CWDataSocket has received from the data source or that have been set locally.

Remarks

Use this property to access the CWData object that holds the current value and attributes. Then use the CWData methods and properties to access the value or specific attributes.

When you connect CWDataSocket to a data target with the cwdsWrite or cwdsWriteAutoUpdate access mode, CWDataSocket writes the current value and attributes to the target as soon as the connection is complete. When you connect DataSocket to a data source with the cwdsRead or cwdsReadAutoUpdate access mode, CWDataSocket completes the connection and starts reading new values.

Use the CWDataSocket.DataUpdated property and the OnDataUpdated event to determine if and when the value or attributes are set or changed.

When a CWDataSocket is disconnected from the previous data item, it retains the value and attributes it last had while connected.

Example

'Get the current value from a DataSocket.
Dim v As Variant
v = CWDataSocket1.Data.Value

'Value is default property in VB, so you don't have to explicitly state it:
v = CWDataSocket1.Data

'Set the value held by a DataSocket to a number
CWDataSocket1.Data.Value = 10

'Set the value held by a DataSocket to a string
CWDataSocket1.Data.Value = "Sample1"

See Also

CWData

ConnectTo

DataUpdated

OnDataUpdated