Problem 1: The DriveListBox control crashes Visual Basic when used with ReSize.

Problem 2: The DriveListBox fails to drop down the list of drives when used with ReSize.

Last updated: January 21, 2007

Applies to: The 16 and 32 bit versions of VB 4.0, VB 5.0, (VB 6.0? see footnote).

Cause: This is due to a bug in the DriveListBox control.

If the font of a DriveListBox is reduced in size past a certain point it will cause the DriveListBox to fail to drop down its list of drives. This happens in either VB 4.0 or VB 5.0. The DriveListBox appears to work correctly in VB 3.0. In VB 4.0 the DriveListBox also severely corrupts internal memory structures when this happens. With just the right combination of controls and events it is possible to produce a situation where controls disapear from the form. It is also possible to crash other programs and corrupt the system registry under Windows 95 when the DriveListBox currupts memory. Basically the operating system becomes unstable when the memory is corrupted and that can lead to just about anything. We have contacted Microsoft about this problem and they have now issued a problem report which can be found under Article ID: Q191104
in the Microsoft knowledge base.

Unfortunately, any resizing technique that is used in combination with the DriveListBox will suffer from this problem. Even native VB code can not overcome the problem.

Don't use the DriveListBox control. If possible, use the CommonDialog control. Another alternative would be to use VB 5.0 to write your own DriveListBox control. Yet another alternative would be to use the DriveListBox, but don't resize the font. As long as the font is not made smaller at runtime you will not experience the problem.

Steps to recreate problem:
To demonstrate this problem create a VB program with one form containing a CommandButton and a DriveListBox. Place the following line of code in the click event of a command button:

Drive1.FontSize = Drive1.FontSize * 0.8

Run the program and verify that the DriveListBox will initially drop down. Now press the CommandButton and then try to drop down the list. You may have to press the CommandButton several times before the font size of the DriveListBox crosses the magic point that causes it to fail. At some point the DriveListBox will fail to drop down the list of available drives.

To demonstrate more serious memory corruption problems under VB 4.0, try the following (at your own risk). Create one form with two CommandButtons create and a DriveListBox and a second form with nothing on it at all. In the click event of one of the CommandButtons on the first form, place this line of code:

Form2.Show 1 'Show form two as modal

In the click event of the other CommandButton place:

Drive1.FontSize = Drive1.FontSize * 0.8

Run the program. Press the first button that shows Form2. Close Form2. Press the second button that changes the font size of the DriveListBox. Try to drop down the list of the DriveListBox. The program may hang, generate a fatal error, a control may vanish from the form or all of the above.

We did limited testing and were not able to recreate this problem in VB 6.0, however, the Microsoft knowledge base article (Q191104) indicates that VB 6.0 is still a problem.

Copyright 2007 by Larcom and Young.
All rights reserved. Revised: January 21, 2007.