Visual Basic Reference

LinkError Event Example

This example is attached to a TextBox control, MyTextBox, that 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. You can adapt this code to a source form by substituting Form_LinkError for MyTextBox_LinkError. This example is for illustration only.

  Private 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, vbExclamation, "MyTextBox"
End Sub