Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RemoveObject
Message
De
30/03/2001 03:52:01
 
 
À
29/03/2001 10:34:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00489831
Message ID:
00490233
Vues:
9
Thanks for the response, I tried removing the column without any reference to it in place.. but It's still "there" in debugger. When you say the column is removed, do you mean if you look at Thisform.oGrid properties (at runtime), you can see
Column1, 3,4,5 ie Column 2 is completely missing?

I am already stepping backwards through the grid so I don't get the out of range error you mention.

I have managed to find a way to detect if the object has already been removed using the Columns[] collection, so that has solved my problem in a round about kind of way, but it's not as clean as I would have hoped

Thanks for the help

Will

>>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,
Will Jones
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform