>I suppose what's confusing me is the fact the column doesn't really get removed properly..
I remove columns all the time in my one and only grid which gets built on the fly in code in about 35 differnt manifestations. I just tested the code, and indeed the column is removed.
>Out of interest, if I have a With..Endwith reference to the column then try and removeObject the column, will that hang onto the reference?
Yes. You do not want the column object "selected" when you try to remove it. Trying to remove any object from its container from within the object to be removed may cause the object to "hang".
Try something like this from within a grid method....
WITH this
FOR lnI = .ColumnCount TO 1 STEP -1
IF .Columns[ lnI ] [meets removal condition]
.RemoveObject( .Columns[ lnI ].Name )
ENDIF
NEXT
ENDWITH
By stepping backward from .ColumnCount, removing columns avoids the nasty out of range index error because lnI can never be greater than the new ColumnCount.
Regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.comNo trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.