FIX: Stack Fault When Move Makes Combo Box Width Too Small

ID: Q95830

1.00 2.00 3.00 WINDOWS

 kbbuglist

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

A Stack Fault results if a Move method changes the Width property of a combo box containing two to eight items to a small value.

The optional third parameter to the Move method changes the width property of the control to which the method applies. Applying the method to the combo box with a third parameter of less then 240 when the scale mode is set to twips, produces a Stack Fault Application Error halting the execution of your application.

WORKAROUND

Changing the Width property, by using the Move method or by setting the property directly, to a value as small as 240 practically eliminates the functionality of the control. At this width, the combo box is barely wide enough to view the drop-down button. Hence no entries in the combo box are visible to the user.

If want your application to move the control to a position where the user can not view the control at that instant, use one of these techniques:

1. Set the Visible property of the combo box to False. 2. Set the Top and Left properties of the combo box to position the control

   outside the visible region of the Form.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.

MORE INFORMATION

The Application Error dialog box indicates that Visual Basic caused the Stack Fault in USER.EXE. However the address differs depending on the version of Visual Basic. In version 2.00, the address is 0007:0CA3. In version 1.00, the address is 0001:707A.

Steps to Reproduce Problem

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

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

2. Add a combo box (Combo1) to Form1.

3. Place the following code in the Form_Click event procedure:

   Sub Form_Click ()
      combo1.AddItem "Item 1"
      combo1.AddItem "Item 2"  ' Add two items to combo1
      combo1.Move 0, 0, 240    ' New position = (0,0);Width = 240
   End Sub

4. From the Run menu, choose Start (ALT, R, S) to run the program.

5. Using the mouse, click Form1. At this point, the combo box moves to the

   upper-left corner of Form1 and its width changes to 240 twips (The
   default ScaleMode).

6. Using the mouse, click Form1 again. An Application Error dialog appears
   stating the following:

      VB caused a Stack Fault in module USER.EXE at 0007:0CA3

   Running Visual Basic version 1.00 displays a similar message with an
   address of 0001:707A.

Additional reference words: buglist1.00 buglist2.00 buglist3.00 fixlist4.00 1.00 2.00 3.00 KBCategory: kbbuglist KBSubcategory: EnvtRun
Keywords          : kbenv EnvtRun kbbuglist
Version           : 1.00 2.00 3.00
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: May 14, 1998