Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
LinkItem Property
Returns or sets the data passed to a destination control in a DDE conversation with another application.
Syntax
object.LinkItem [= string]
The LinkItem property syntax has these parts:
Part | Description |
Object | An object expression that evaluates to an object in the Applies To list. |
String | A string expression that specifies the data to be passed to the destination control. |
Remarks
This property corresponds to the item argument in the standard DDE syntax, with application, topic, and item as arguments. To set this property, specify a recognizable unit of data in an application as a reference for example, a cell reference such as "R1C1" in Microsoft Excel.
Use LinkItem in combination with the LinkTopic property to specify the complete data link for a destination control to a source application. To activate this link, set the LinkMode property.
You set LinkItem only for a control used as a destination. When a Visual Basic form is a source in a DDE conversation, the name of any Label, PictureBox, or TextBox control on the form can be the item argument in the application**|topic!**item string used by the destination. For example, the following syntax represents a valid reference from Microsoft Excel to a Visual Basic application:
=VizBasicApplication**|MyForm!**TextBox1
You could enter the preceding syntax for a destination cell in the Microsoft Excel formula bar.
A DDE control can potentially act as destination and source simultaneously, causing an infinite loop if a destination-source pair is also a source-destination pair with itself. For instance, a TextBox control may be both a source (through its parent form) and destination of the same cell in Microsoft Excel. When data in a Visual Basic TextBox changes, sending data to Microsoft Excel, the cell in Microsoft Excel changes, sending the change to the TextBox, and so on, causing the loop.
To avoid such loops, use related but not identical items for destination-source and source-destination links in both directions between applications. For example, in Microsoft Excel, use related cells (precedents or dependents) to link a worksheet with a Visual Basic control, avoiding use of a single item as both destination and source. Document any application**|**topic pairs you establish if you include a Paste Link command for run-time use.
Note Setting a permanent data link at design time with the Paste Link command from the Edit menu also sets the LinkMode, LinkTopic, and LinkItem properties. This creates a link that is saved with the form. Each time the form is loaded, Visual Basic attempts to re-establish the conversation.