BUG: CTRL+LEFT/RIGHT ARROW Behaves Differently When Edit/Type

ID: Q77928

The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SYMPTOMS

The key combinations CTRL+LEFT ARROW and CTRL+RIGHT ARROW work differently when editing code in a procedure than when typing in the Immediate window.

In the Immediate window, CTRL+LEFT ARROW will move the cursor in front of the preceding word even if that word is one of the following symbols:

   ! @ # $ % ^ ^ & * ( ) { } : ; , " ' [ ] < >

In the code editor, these symbols are not treated as words, so the cursor skips over them when using the ARROW key combinations to position the insertion point.

STATUS

Microsoft has confirmed this to be a bug in the VB.EXE environment of the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

In a code window, using the LEFT ARROW key with the CTRL key held down will move the cursor to the beginning of the preceding word or letter on that line, disregarding any punctuation marks and other symbols -- that is, any character obtained by typing a number while holding down the SHIFT key, all punctuation marks, brackets, braces, single quotation marks, and double quotation marks.

In the Immediate window, only the period is not treated as a word and is skipped over when using the CTRL+LEFT ARROW or CTRL+RIGHT ARROW key combination.

Steps to Reproduce Problem

1. Start Visual Basic or from the File menu, choose New Project (ALT, N, P)

   if Visual Basic is already running. Form1 is created by default.

2. Press F7 or double-click Form1 to bring up the code window.

3. Enter the following code in the Form_Click event procedure of Form1:

   Sub Form_Click()
      print "Home."
   End Sub

4. While the cursor is still at the end of the line, press CTRL+LEFT ARROW
   to move the cursor to the beginning of the previous word. The cursor
   should move directly in front of the H in Home.

5. From the Run menu, choose Start to run the program.

6. Press CTRL+BREAK to bring up the Immediate window.

7. Type the following in the Immediate window:

   Print "Home."

9. With the cursor at the end of the line, press CTRL+LEFT ARROW. The
   insertion point should be directly in front of the last double quotation
   mark.

Keywords          : kbenv buglist2.00 buglist3.00 kbvbp100bug EnvtDes kbbuglist
Version           : 1.0 2.0 3.0
Platform          : WINDOWS
Issue type        : kbbug

Last Reviewed: August 14, 1997