Microsoft KB Archive/190266

= PRB: Code Copied From MSDN VStudio Help Is Improperly Formatted =

Article ID: 190266

Article Last Modified on 8/11/2005

-

APPLIES TO


 * MSDN 2003 Universal Edition
 * Microsoft Visual Studio 6.0 Enterprise Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition
 * Microsoft Visual J++ 6.0 Standard Edition

-



This article was previously published under Q190266



SYMPTOMS
When you copy code examples from the MSDN Library Visual Studio 6.0 Help Viewer, it omits some carriage return/line feed characters and the code is not formatted correctly.



CAUSE
Invisible formatting tags are included at the start and end of each example, and the code cannot be formatted properly if you do not copy these tags.



RESOLUTION
When copying code, be sure to completely include the first and last lines of the code example.



STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The documentation for Visual Studio 6.0 is accessed from a common viewer called MSDN Library Visual Studio 6.0 Help Viewer. All Visual Studio 6.0 products that have code examples are affected by this problem. These include, but may not be limited to, Visual FoxPro 6.0, Visual Basic 6.0, Visual C++ 6.0 and Visual J++ 6.0.

Steps to Reproduce Behavior
Using Visual FoxPro:  In Visual FoxPro, type the following in the Command Window and press enter:

help DATE

 In the DATE Function topic page, click the Example hyperlink. Using your mouse, select any multiple-line portion of the code in the example that excludes either the first or last lines of the code, or both. Press Ctrl+C to copy the highlighted code. Paste the code into an edit window in Visual FoxPro, or into another application such as Notepad.</li></ol>

RESULT: Some of the line feeds are omitted. Using the DATE Function example, if you copy the second, third, and fourth lines the code is formatted as follows:

SET CENTURY OFF? DATE && Displays today's date without the century. SET CENTURY ON

The correct formatting is:

SET CENTURY OFF ? DATE && Displays today's date without the century. SET CENTURY ON

If you copy the entire code example, including the entire first and last lines, the code is formatted as follows:

CLEAR SET CENTURY OFF ? DATE && Displays today's date without the century. SET CENTURY ON  ? DATE  && Displays today's date with the century. ? DATE(1998, 02, 16) && Displays a year 2000-compliant Date value.

Using Visual Basic:
 * 1) In Visual Basic Help, find the ActiveControl Property topic.
 * 2) In the ActiveControl Property topic, click the Example hyperlink.
 * 3) Using your mouse, select any multiple-line portion of the code in the example that excludes either the first or last lines of the code, or both.
 * 4) Press Ctrl+C to copy the highlighted code.
 * 5) Paste the code into the Code Window in Visual Basic, or into another application such as Notepad.

RESULT: Some of the line feeds are omitted. Using the ActiveControl Property example, if you copy the second through the sixth lines the code is formatted as follows:

If TypeOf Screen.ActiveControl Is TextBox Then Label1.Caption = Screen.ActiveControl.Text  Else Label1.Caption = "Button: " + Screen.ActiveControl.Caption  End If

The correct formatting is:

If TypeOf Screen.ActiveControl Is TextBox Then Label1.Caption = Screen.ActiveControl.Text Else Label1.Caption = "Button: " + Screen.ActiveControl.Caption End If

If you copy the entire code example, including the entire first and last lines, the code is formatted as follows:

Private Sub Form_Click If TypeOf Screen.ActiveControl Is TextBox Then Label1.Caption = Screen.ActiveControl.Text Else Label1.Caption = "Button: " + Screen.ActiveControl.Caption End If  End Sub

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Jim Saunders, Microsoft Corporation

Keywords: kbprb KB190266

-

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

© Microsoft Corporation. All rights reserved.