FIX: Grid is Empty with Incorrect Column ControlSource (168043)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a

This article was previously published under Q168043

SYMPTOMS

Specifying an invalid column ControlSource name in a Grid results in an empty grid in Visual FoxPro 5.x. However, in Visual FoxPro 3.x, this results in the following error, which is expected:
"Error loading File - ControlSource..., Variable "column name" is not found"

RESOLUTION

Check the ControlSource names in each column and make sure they are valid names.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This has been corrected in Visual FoxPro 6.0.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Run the following code from a program (.PRG) file:
          SET SAFETY ON
          USE HOME()+'samples\data\customer'
          LOCAL aobj[1], ox
          CREATE FORM TEMP NOWAIT
          =ASELOBJ(aobj,1)
          ox = aobj[1]
          ox.AddObject('grid1','Grid')
          WITH ox.grid1
             .Recordsource = 'customer'
             .Visible = .T.
             .ColumnCount = 2
             .Column1.ControlSource = 'customer.cust_id'
    
             * Purposely put an invalid column controlsource name
                  .Column2.ControlSource = 'customer.Xcontact'
    
             * To display the Grid correctly set:
             *   .Column2.ControlSource = 'customer.contact'
    
          ENDWITH
          KEYBOARD 'Y' CLEAR
          RELEASE WINDOW 'Form Designer'
          DO FORM temp
    							
  2. Form shows up with an empty grid.

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug KB168043