Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Defaults to Table Layout
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01276611
Message ID:
01276636
Views:
18
>Hi Gang!
>
>Strange problem here!
>
>I have a form with a grid (grdDetail)on it. It works well with a controlsource called REORDER.
>
>I wanted to add another grid (grdDetailManual) to the form (not visible at this point when run), with a controsource called REORDER2. It is a COPY of the original grid. I went in and changed the Recordsource of the grid and its columns to be REORDER2. It's job, when run later and visible, is to be a temporary holding place for order details, and then the data from this is transfered to the table REORDER.
>
>When, run, this new grid does not display the data as the original grid did. It displays the data in a default layout, like the fields are arranged in the table. In fact, the recordsource of each column is "NONE", now. If I go back and reassigned each column to REORDER.fieldname, it still changes back to "NONE" after saving the form.
>
>What am I totalling overlooking here??

Tommy,
1st guess is to ask did you also set the grid RecordSource to the new table?
My fix for all these types of grid problems is to set the grid data sources in code. This works for all types of things like leaving the form to run another form, etc. Here is an example with some other stuff thrown in. The DoScroll at the bottom places the current record in the middle of the grid. Adjust the count to your grid height.

Call this every time you want to show the grid.
PROCEDURE lSetGrid
*
lParameters oForm
With oForm.grdLines
  .RecordSource = 'jsbaklog'
  .Column1.ControlSource = 'Thisform.GetRunDate(jsbaklog.startdtt)'
  .Column2.ControlSource = 'jsbaklog.runtime'
  .Column3.ControlSource = 'jsbaklog.zipfile'
  .Column4.ControlSource = 'Thisform.GetStatus()'
  .Column5.ControlSource = 'jsbaklog.filesize'
  *
  .Column1.ReadOnly = .t.
  .Column2.ReadOnly = .t.
  .Column3.ReadOnly = .t.
  .Column4.ReadOnly = .t.
  .Column5.ReadOnly = .t.
  *
  for i = 1 to 14
   .DoScroll(0)
  endfor
EndWith
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform