Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RemoveObject
Message
De
29/03/2001 10:34:03
 
 
À
29/03/2001 10:19:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00489831
Message ID:
00489873
Vues:
9
>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 && the grid
    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.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform