Microsoft KB Archive/165975

= PRB: Line Continuation Character (_) Causes Event Concatenation =

Article ID: 165975

Article Last Modified on 6/30/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q165975



SYMPTOMS
The code window shows each event procedure of a control individually in the default procedure view. Adding a space and a line continuation character (an underscore "_") after the line of code preceding the End Sub statement results in the following event of the same control to appear. If the Full Module View check box in the Editor Tab of the Options dialog box is clicked, the line separating the two procedures disappears.



STATUS
This behavior is by design.



MORE INFORMATION
The line continuation character causes the next line of code to be concatenated with the code line containing the line continuation character. Visual Basic then considers the procedure containing the line continuation character as part of the next event procedure.

Steps To Reproduce Behavior
 Start Visual Basic, or, if it is already running, click New Project from the File menu.  Copy and paste the following code to the Form1 Code Window: Private Sub Form_Click MsgBox "world" End Sub

Private Sub Form_Load MsgBox "hello" End Sub

You should see only the Form_Load event in the code window.   In the Form_Click event, type a space followed by a line continuation character (_) after the code line for the message box in the Form_Click procedure event. The code should look like the following: Private Sub Form_Click MsgBox "world" _ End Sub After you press the ENTER key, the Form_Click and the Form_Load procedure events appear in the same procedure event. If the Full Module View checkbox is checked, then the line separating the procedures disappears. 

Additional query words: kbVBp500 kbVBp600 kbVBp kbdsd kbDSupport kbVBp400 kbIDE

Keywords: kbprb KB165975

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.