Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to re-create all columns in grid
Message
De
18/09/2001 15:15:27
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00556193
Message ID:
00558049
Vues:
40
I you are seriously interested about fixing this, I can send you the source code. I may try to simplify it much as possible without losing C5 functionality
but it will be still a hunders of lines for code and many classes. Future simplification will lose the functionality I need.


>First I created a copy of my Foxuser table and called it FXUser.dbf/fpt. I put a grid on a form and named it Grid1. In the Click of a command button I placed the following code:
>LOCAL lcSource, lnCount, lnI, lnJ, lnK
>FOR lnJ = 1 TO 1000
>   WITH ThisForm.Grid1
>      lcSource = .RecordSource
>      .RecordSource = ""
>      lnCount = .ColumnCount
>      FOR lnI = lnCount TO 1 STEP -1
>         .RemoveObject(.Columns(lnI).Name)
>      ENDFOR
>      FOR lnI = 1 TO 3
>         .AddObject('Column' + TRANSFORM(lnI), 'Column')
>         IF lnI = 2
>            .Columns(lnI).AddObject("Combo1", "Combobox")
>            .Columns(lnI).RemoveObject("Text1")
>            .Columns(lnI).CurrentControl = "Combo1"
>         ENDIF
>         .Columns(lnI).Visible = .t.
>      ENDFOR
>      lnK = 1
>      .RecordSource = (lcSource)
>      FOR lnI = 1 TO 3
>         DO WHILE lnK <= FCOUNT(lcSource) AND NOT INLIST(TYPE(FIELD(lnK)), "C", "D")
>            IF lnK > FCOUNT(lcSource)
>               EXIT
>            ENDIF
>            lnK = lnK + 1
>            LOOP
>         ENDDO
>         .Columns(lnI).ControlSource = lcSource + "." + FIELD(lnK)
>         lnK = lnK + 1
>      ENDFOR
>   ENDWITH
>ENDFOR
>I have clicked the button several times and got no C5 error. Please try exactly what I did and see if you get the error.
Andrus
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform