VB Spin Button: SpinOrientation Incorrectly Accepts Value of 2

ID Number: Q84270

1.00

WINDOWS

Summary:

The Spin Button custom control (SPIN.VBX) incorrectly accepts a value

of 2 for its SpinOrientation property. The only values it should

accept are 0 (Vertical), and 1 (Horizontal). A value of 2 has no

meaning to the SpinOrientation property, yet does not cause an error,

as other incorrect values do, in either run or break mode.

Microsoft has confirmed this to be a problem in Microsoft Professional

Toolkit for Microsoft Visual Basic programming system version 1.0 for

Windows. We are researching this problem and will post new information

here as it becomes available.

More Information:

SpinOrientation is a property of the Spin Button custom control that

determines whether the button arrows point vertically (SpinOrientation

= 0) or horizontally (SpinOrientation = 1). Values other than 0 or 1

should cause the error message "Invalid property value".

Steps to Reproduce Problem

--------------------------

1. Run 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. From the File menu, choose Add File. In the Files box, select the

SPIN.VBX custom control file. The Spin Button tool appears in the

Toolbox.

3. Add a Spin Button to Form1.

4. Press F5 to run the program.

5. From the Run menu, choose Break to pause the program.

6. In the Immediate window, enter the following:

Spin1.SpinOrientation = 2

No error occurs; however, an error should occur, because 2 is not a

valid selection for the SpinOrientation property. If, however, you

enter "Spin1.SpinOrientation = 3" in the Immediate window, the error

message "Invalid property value" is returned.

The same problem also occurs when the SpinOrientation is changed

programmatically, as in the following example:

1. Add a Spin Button and four command buttons to Form1.

2. Add the following code:

Sub Command1_Click ()

Spin1.SpinOrientation = 0 'valid: vertical

End Sub

Sub Command2_Click ()

Spin1.SpinOrientation = 1 'valid: horizontal

End Sub

Sub Command3_Click ()

Spin1.SpinOrientation = 2 'invalid: but no error given

End Sub

Sub Command4_Click ()

Spin1.SpinOrientation = 3 'invalid: error message given

End Sub

3. Press F5 to run the program.

When you choose any of the four command buttons, the SpinOrientation

property of Spin1 is changed. Command1 and Command2 change the

SpinOrientation to its valid values, 0 and 1, respectively. Command3

changes SpinOrientation to 2, which is incorrectly ignored by the Spin

Button control. Command4 changes SpinOrientation to 3, another invalid

value, but which correctly gives the error message "Invalid property

value" when chosen.

Additional reference words: 1.00