BUG: Runtime Changes to the Grid Not Saved Correctly

Last reviewed: May 1, 1997
Article ID: Q134251
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a

SYMPTOMS

The AddColumn method allows a column to be added to a grid at runtime. However, if a column is added between two existing columns and the form is saved using the Thisform.Saveas method, the column order of the grid is not saved correctly. Altough, at runtime the column appears in the correct order. The column added between the existing columns becomes the last column on the grid when the saved screen is modified.

WORKAROUND

Use this command:

   Thisform.<gridname>.column(n).colunmnorder = <number>

Here <number> is the column position you want the newly created column to be. Issue this command after you have inserted the column and before using the ThisForm.SaveAs command.

STATUS

Microsoft has confirmed this to be a problem 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

Steps to Reproduce Behavior

  1. Create a new form called x.

  2. In the data environment, add any table.

  3. Drag the table from the data environment to the form to create a grid on the form.

  4. Save the form.

  5. Create a program called Testobj.prg, and add this code:

    set safety off do form x

       x.grid1.name='mygrid'      && change the default grid name to "mygrid"
       x.mygrid.columncount=2     && dimension the column count to 2
       x.mygrid.column1.width=8
       x.mygrid.addcolumn(2)      && add a new column between existing columns
       x.mygrid.column3.header1.name='HdrItem' && change the header name
       x.mygrid.column3.name='colItem'         && change the column name
       x.mygrid.colItem.hdrItem.caption='Item' && change the caption name
       x.saveas('y')                           && save the Form as "y"
       modify form y
    
    

  6. Run the program. When the program is running, observe the difference between the grid column order of the running form (x) and the modified form (y). The running form contains the new column (ColItem) in the correct order as required by the program, but the modified form doesn't.

Example Workaround

To correct the problem, add the following line of code to Testobj.prg before the x.savas('y') command. Then run the program again.

   x.mygrid.colItem.columnorder = 2


Additional query words: 5.00 3.00 3.00b
Keywords : buglist3.00 buglist3.00b buglist5.00 FxtoolAccessory vfoxwin vfpbug5.0a kbbuglist
Version : 3.0 3.0b 5.0 5.0a
Platform : WINDOWS
Issue type : kbbug


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 1, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.