Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing A Grid On The Fly
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Changing A Grid On The Fly
Miscellaneous
Thread ID:
00478467
Message ID:
00478467
Views:
54
I have a grid with a Field Chooser button next to it. When the user
clicks it, a list of fields, generated from the control sources of
each grid column, is displayed in a list. The user can add, remove
or re-arrange the list items. The list is then transfered to an array.

I then want to rebuild the grid using the array. The code I have is:

   FOR nColumn = oGrid.ColumnCount TO 1 STEP -1
     oGrid.DeleteColumn(nColumn)
   ENDFOR

   oGrid.RecordSource = cRecordSource

   FOR nColumn = 1 TO nTotalCols
     cColName = aFldNames[nColumn]
     oGrid.AddColumn(nColumn)
     oGrid.Columns[nColumn].ControlSource = cColName
     oGrid.Columns[nColumn].Header1.Caption = cColName
     oGrid.Columns[nColumn].ReadOnly = .T.
   ENDFOR


When I put the oGrid.RecordSource line BEFORE the AddColumns loop, I get all
fields in the table, then the fields I added.

When I put the oGrid.RecordSource line AFTER the AddColumns loop, regardless
of what I specified as the control source in the loop, the ControlSources are
always set up first field in the table to last.

What am I doing wrong here?

Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform