BUG: Picture Box Limits CurrentX & CurrentY of -32768 to 32767

Last reviewed: May 6, 1996
Article ID: Q150236
The information in this article applies to:
  • Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit only, for Windows, version 4.0

STATUS

The Picture box limits setting of the CurrentX and CurrentY values to between -32768 to +32767 twips, which are the limits of a signed integer. This behavior occurs because CurrentX and CurrentY are stored as Singles. The Height and Width properties of the Picture box can be made larger than the limits given.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

To set the CurrentX and CurrentY values to larger values than the limits given, use the PSet method. For example, the following line of code sets the X and Y positions to 40000, 40000:

   Picture1.PSet (40000, 40000), Picture1.BackColor

A debug print of the CurrentX and CurrentY values after the statement above is executed confirms that they hold the correct values of 40000,40000.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Place a Picture box on Form1.

  3. Place the following code in the Click event of Form1:

          Private Sub Form_Click()
          Picture1.Height = 40001
          Picture1.Width = 40001
          Picture1.CurrentX = 40000
          End Sub
    

Run the program by pressing F5, and click the form. The following error occurs:

   Run-time error '6'
   Overflow

To implement the workaround, change the code in the Click event to:

   Private Sub Form_Click()
   Picture1.Height = 40001
   Picture1.Width = 40001
   Picture1.PSet (40000, 40000), Picture1.BackColor
   MsgBox Picture1.CurrentX
   End Sub


Additional reference words: 4.00 vb4win vb416
KBCategory: kbprg kbbuglist
KBSubcategory: PrgOther



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 6, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.