Knowledge Base |

# BUG: Corruption of TabIndex Property of Custom Controls

PSS ID Number: 118419

Article Last Modified on 1/9/2003

The information in this article applies to:

- Microsoft Visual Basic for MS-DOS 1.0

This article was previously published under Q118419

## SYMPTOMS

Visual Basic for MS-DOS changes the TabIndex property of custom controls in a control array at run time. This behavior occurs in the IDE as well as in compiled executable programs.

## WORKAROUND

Since Visual Basic for MS-DOS can corrupt the TabIndex property of custom controls with an Index of 0 or 1, start with an Index of 2 (skipping 0 and 1) to avoid problems.

## STATUS

Microsoft has confirmed this to be a bug in Microsoft Visual Basic for MS-DOS, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

## MORE INFORMATION

### Steps to Reproduce Problem

1. Load Visual Basic for MS-DOS using this command line:

          VBDOS /L SPIN.QLB

2. Create a form and add a control array of three spin controls in the lower-right corner of the form. Verify that the three controls have TabIndex and Index property values 0, 1, and 2 from left to right.
3. Add the following Sub procedure to the application:

          SUB Custom1_Custom (Index AS INTEGER, EventType AS INTEGER)
             FOR i = 0 TO 2
                PRINT Custom1(i).TabIndex;
             NEXT
             PRINT
          END SUB

4. Run the application, and click any of the controls. The values printed should be 0 1 2, but instead appear as 0 2 1.
5. Exit the program and verify that the TabIndex property of each control in the control array is back to its original value.
6. Add three more spin controls to the form. Verify the TabIndex property of each control.
7. Replace the PRINT line of the Custom1_Custom Sub procedure with this:

          PRINT Custom2.TabIndex; Custom3.TabIndex; Custom4.TabIndex

8. Run and click any of the first three controls. The values printed should be 0 1 2 3 4 5, but instead appear as 0 5 1 2 3 4.
9. Exit the program and verify that the TabIndex property of each control is back to its original value.

The TabIndex property of the second element of the control array is set to the last TabIndex on the form. All TabIndex properties greater than the original value of the TabIndex property of the second element in the control array are decreased by 1. It therefore becomes possible to work around this problem by setting all TabIndexes to the values they will assume when the program is run.

Additional query words: VBmsdos Buglist1.00 1.00

Keywords: kbbug KB118419
Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3