Visual Basic Reference

Visual Studio 6.0

LinkMode Property

See Also    Example    Applies To

Returns or sets the type of link used for a DDEconversation and activates the connection as follows:

  • Control Allows a destination control on a Visual Basic form to initiate a conversation, as specified by the control's LinkTopic and LinkItem properties.

  • Form Allows a destination application to initiate a conversation with a Visual Basic source form, as specified by the destination application's application|topic!item expression.

Syntax

object.LinkMode [= number]

The LinkMode property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Number An integer that specifies the type of connection, as described in Settings.

Settings

For controls used as destinations in DDE conversations, the settings for number are:

Constant Setting Description
VbLinkNone 0 (Default) None No DDE interaction.
VbLinkAutomatic 1 Automatic Destination control is updated each time the linked data changes.
VbLinkManual 2 Manual {Destination control is updated only when the LinkRequest method is invoked.
VbLinkNotify 3 Notify A LinkNotify event occurs whenever the linked data changes, but the destination control is updated only when the LinkRequest method is invoked.

For forms used as sources in DDE conversations, the settings for number are:

Constant Setting Description
VbLinkNone 0 (Default) None No DDE interaction. No destination application can initiate a conversation with the source form as the topic, and no application can poke data to the form. If LinkMode is 0 (None) at design time, you can't change it to 1 (Source) at run time.
VbLinkSource 1 Source Allows any Label, PictureBox, or TextBox control on a form to supply data to any destination application that establishes a DDE conversation with the form. If such a link exists, Visual Basic automatically notifies the destination whenever the contents of a control are changed. In addition, a destination application can poke data to any Label, PictureBox, or TextBox control on the form. If LinkMode is 1 (Source) at design time, you can change it to 0 (None) and back at run time.

Remarks

The following conditions also apply to the LinkMode property:

  • Setting LinkMode to a nonzero value for a destination control causes Visual Basic to attempt to initiate the conversation specified in the LinkTopic and LinkItem properties. The source updates the destination control according to the type of link specified (automatic, manual, or notify).

  • If a source application terminates a conversation with a Visual Basic destination control, the value for that control's LinkMode setting changes to 0 (None).

  • If you leave LinkMode for a form set to the default 0 (None) at design time, you can't change LinkMode at run time. If you want a form to act as a source, you must set LinkMode to 1 (Source) at design time. You can then change the value of LinkMode at run time.

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.

Show: