See Also Example
Applies To
Form, MDI Form
Description
Occurs when there is an error during a DDE 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.
Syntax
Sub { Form|MDIForm}_LinkError (LinkErr As Integer)
Sub ctlname_LinkError ([Index As Integer,]LinkErr As Integer)
Remarks
The LinkError event uses these arguments:
Argument Description
Index Uniquely identifies a control if it is in a control array .
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 MsgBox function and MsgBox 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 destination application attempted to continue performing DDE after you set the LinkMode on your source 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.
Help:
LinkClose Event
LinkExecute Event
LinkExecute Method
LinkItem Property
LinkMode Property
LinkNotify Event
LinkOpen Event
LinkTopic Property
Using DDE
Programmer's Guide:
Chapter 20, "Communicating with Other Applications"
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