LinkError Event

See AlsoAMDIRW              ExampleGS4BBR>Low

Applies To

Form14TJ2LN, MDI Form1ILMZQ7, label3MNIZ8D, picture box31MYIWX, text boxYPYZDG.


Occurs when there is an error during a DDEDEFDDE conversation.  This event is recognized only as the result of a DDE-related error that occurs when no Visual Basic code is being executed.  The error number is passed as an argument.


SubForm|MDIForm}_LinkError (LinkErr As Integer)

Sub ctlname_LinkError ([Index As Integer,]LinkErr As Integer)


The LinkError event uses these arguments:

Argument     Description


Index             Uniquely identifies a control if it is in a control array8G7Y0UU.

LinkErr          The error number.


Use a LinkError procedure to notify the user of the particular error that has occurred.  You might also include code to fix the problem, or troubleshooting information on reestablishing a connection or on where to go for assistance.  For brief messages, use the MsgBoxZKF8GC function and MsgBoxZKF8GC statement.

The following table lists all error numbers returned for the LinkErr argument and a brief explanation of each error.

Error number   Explanation


   1                    The other application has requested data in the wrong format.  This error may occur several times in succession as Visual Basic tries to find a format the other application recognizes.

   6                    The destinationHF8UZ8 application attempted to continue performing DDE after you set the LinkMode on your sourceO9K12R form to 0 (None).

   7                    All the source links are in use (there is a limit of 128 links per source).

   8                    For destination controls: an automatic link or LinkRequest method failed to update the data in the control.

                         For source forms: the destination attempted to poke data to a control and the attempt failed.

11                    Not enough memory for DDE.


The missing numbers in this table correspond to error values that were supported in Visual Basic 1.0 but no longer occur in more recent versions of Visual Basic.

See Also


LinkClose Event17O5TU0

LinkExecute Event1OO8NGN

LinkExecute Method0JJE0GF

LinkItem Property2NMGNS5

LinkMode PropertyM1RK6S

LinkNotify Event1PIR0GG

LinkOpen EventM1TL81

LinkTopic PropertyEVWV3S



Programmer's Guide:

Chapter 20, "Communicating with Other Applications"

LinkError Event Example

The example is attached to a text box control, MyTextBox, which handles selected errors.  The procedure displays a message (adapted from the error list in the LinkError Event topic), based on the error number passed as the argument LinkErr.  Note that you can adapt this code to a source form by substituting Form_LinkError for MyTextBox_LinkError.  This example is for illustration only.

Sub MyTextBox_LinkError (LinkErr As Integer)

Dim Msg

   Select Case LinkErr

      Case 1

         Msg = "Data in wrong format."

      Case 11

         Msg = "Out of memory for DDE."

   End Select

   MsgBox Msg, 48, "MyTextBox"

End Sub