BUG: Graph: AutoInc Increments ThisPoint Instead of ThisSet

Last reviewed: June 21, 1995
Article ID: Q81999
The information in this article applies to:

- Professional Edition of Microsoft Visual Basic for Windows,

  versions 2.0 and 3.0
- Microsoft Professional Toolkit for Microsoft Visual Basic programming
  system for Windows, version 1.0

SYMPTOMS

The Graph custom control version 1.2 has four array properties: ColorData, LegendText, PatternData, and SymbolData. The values of these properties directly affect sets of data rather than the individual points in the sets. With the AutoInc property set to True, assigning a value to these four arrays will increment ThisPoint rather than ThisSet. This behavior is a potential cause of logic errors in code.

WORKAROUND

To work around the potential logic problems caused by incrementing ThisPoint, you should occasionally reset the AutoInc incrementing position by assigning values for ThisSet and ThisPoint in your code.

A second workaround is to set AutoInc to False (AutoInc=0), and explicitly set ThisSet and ThisPoint before entering a piece of data.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

There are eight array properties in Graph: GraphData, ExtraData, LabelText, XPosData, ColorData, LegendText, PatternData, and SymbolData. To access an individual point in these arrays, you need to set the ThisSet and ThisPoint properties to indicate that point. If AutoInc is set to True (AutoInc=1), Graph will automatically set the ThisPoint and ThisSet properties.

AutoInc increments ThisSet and ThisPoint differently, depending on which property is being accessed. AutoInc will increment both ThisSet and ThisPoint when adding data to the GraphData property. For all other array properties (ExtraData, LabelText, XPosData, ColorData, LegendText, PatternData, and SymbolData), AutoInc will only increment ThisPoint. The data that you assign to the ExtraData, LabelText, and XPosData apply to the individual points of a set, so logically AutoInc should only increment ThisPoint. However, the data that you assign to the ColorData, LegendText, PatternData, and SymbolData array properties apply to the separate sets. In these cases, AutoInc should logically be incrementing the ThisSet property, but in practice it increments only the ThisPoint property.

Note: AutoInc is incrementing the proper values internally, so the data assigned to these four array properties is accurate and will function properly. AutoInc displays its progress by also incrementing ThisPoint, which is not always the logical choice.

The following example demonstrates how AutoInc increments ThisPoint and ThisSet when assigning values to ColorData. To test another array property, substitute that array name for ColorData.

Steps to Reproduce Problem

  1. With Visual Basic running and the Graph custom control loaded, create a form (Form1).

  2. On Form1, add a command button (Command1), a picture box (Picture1), and a graph control (Graph1).

  3. Change the following properties for Command1:

       Control    Property    Value
       ----------------------------------
    
       Command1   Caption     "Start"
       Graph1     AutoInc      1  (true)
       Graph1     NumSets      2
       Graph1     NumPoints    3
    
    

  4. Add the following code to the Command1 Click event:

       Sub Command1_Click ()
    
          Command1.Caption = "ColorData"   'set caption equal to array
                                           'property name to be tested
          Picture1.Cls
          Picture1.Print "ThisSet", "ThisPoint"
          ' loop through full array:
          For i = 1 To Graph1.NumSets * Graph1.NumPoints
             Picture1.Print Graph1.ThisSet, Graph1.ThisPoint
             Graph1.ColorData = 1  'Make some valid assignment so
                                   ' AutoInc increments
          Next
          Graph1.DrawMode = 2              'display newly assigned values
    
       End Sub
    
    

  5. Press F5 to run the program.

When you run the program and click the Command1 button, the program will display the array property being tested, and the picture box will display the increment pattern of ThisSet and ThisPoint as the program loops through the array property. The graph is then updated to display the newly assigned values.


Additional reference words: buglist1.00 buglist2.00 buglist3.00 1.00 2.00
3.00 buglist1.00 buglist2.00
buglist3.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsCus


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: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.