Hi Cindy
Had hell of a day! But it was not VFP that made it such a stress. <g>
I noticed you got already help, that's fine. (BTW I really didn't know
that raising ColumnCount adds a new Column during runtime. You'll never
stop learning <bg>)
Basing on your original approach I figured out the following that should
work too:
LOCAL lnOldSelect, lnKounter, lcControlSource, lnKounter
*
lnOldSelect = SELECT()
SELECT GridColumns
GO TOP
lnKounter = 1
WITH
SCAN FOR .T.
*
lnKounter= MAX(1, MIN(GridColumns.ColumnNo,.ColumnCount+1))
* This will hold lnKounter inside reasonable range,
* when your table should be disordered.
.ADDCOLUMN(lnKounter) && Becomes Columns(lnKounter)
.COLUMNS(lnKounter).Header1.CAPTION = GridColumns.ColumnName
.COLUMNS(lnKounter).READONLY = .T.
lcControlSource = pcTableName + [.] + ALLT(GridColumns.GridColumn)
.COLUMNS(lnKounter).CONTROLSOURCE = (lcControlSource)
ENDSCAN
ENDWITH
SELECT (lnOldSelect)
Regards
Markus
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement