Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing A Grid On The Fly
Message
De
22/02/2001 12:05:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00478467
Message ID:
00478487
Vues:
31
>I have a grid with a Field Chooser button next to it. When the user
>clicks it, a list of fields, generated from the control sources of
>each grid column, is displayed in a list. The user can add, remove
>or re-arrange the list items. The list is then transfered to an array.
>
>I then want to rebuild the grid using the array. The code I have is:
>
>   FOR nColumn = oGrid.ColumnCount TO 1 STEP -1
>     oGrid.DeleteColumn(nColumn)
>   ENDFOR
>
>   oGrid.RecordSource = cRecordSource
>
>   FOR nColumn = 1 TO nTotalCols
>     cColName = aFldNames[nColumn]
>     oGrid.AddColumn(nColumn)
>     oGrid.Columns[nColumn].ControlSource = cColName
>     oGrid.Columns[nColumn].Header1.Caption = cColName
>     oGrid.Columns[nColumn].ReadOnly = .T.
>   ENDFOR
>

>
>When I put the oGrid.RecordSource line BEFORE the AddColumns loop, I get all
>fields in the table, then the fields I added.
>
>When I put the oGrid.RecordSource line AFTER the AddColumns loop, regardless
>of what I specified as the control source in the loop, the ControlSources are
>always set up first field in the table to last.
>
>What am I doing wrong here?
>
>Thanks

Kevin,
Try adding :
.Columncount = -1
before recordsource assignment.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform