Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing grid's RowSource in Design-time
Message
 
 
À
03/07/2002 02:14:33
Dorin Vasilescu
ALL Trans Romania
Arad, Roumanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00674623
Message ID:
00674930
Vues:
28
Great, thanks a lot. I was thinking about that...

BTW, I decided to take another route for this form. I will leave grid without RecordSource and columns and will build it in run-time using a table. This way I can use the same form for different tables.

>I have a small procedure that can do this, using ASELOBJ() function.
>Grid must be selected in Form Designer
>
>Usage: ChangeGridSource( [cNewRecordSource] )
>
>
>Here is the code
>
>PROCEDURE ChangeGridSource
>LPARAMETERS tcNewRecordSource
>LOCAL lnSelObjectCount, loGridRef, lnCnt
>LOCAL ARRAY laSelectedObject[1], laColumnSources[1]
>lnSelObjectCount = ASELOBJ(laSelectedObject)
>IF lnSelObjectCount = 0
>	WAIT WINDOW 'Select a grid in Form Designer first' nowait
>	RETURN
>ENDIF
>loGridRef = laSelectedObject[1]
>IF loGridRef.BaseClass <> 'Grid'
>	WAIT WINDOW 'One Grid object must be selected' nowait
>	RETURN
>ENDIF
>IF loGridRef.ColumnCount>0
>	DIMENSION laColumnSources[loGridRef.ColumnCount]
>	FOR lnCnt = 1 TO loGridRef.ColumnCount
>		laColumnSources[lnCnt] = JUSTEXT(loGridRef.Columns(lnCnt).controlsource)
>	NEXT
>ENDIF
>loGridRef.RecordSource = tcNewRecordSource
>FOR lnCnt = 1 TO loGridRef.ColumnCount
>	IF !EMPTY(laColumnSources[lnCnt])
>		loGridRef.Columns(lnCnt).ControlSource = tcNewRecordSource+'.'+laColumnSources[lnCnt]
>		loGridRef.Columns(lnCnt).setall('ControlSource',tcNewRecordSource+'.'+laColumnSources[lnCnt])
>	ENDIF
>NEXT
>
>
>
>Hope this help
>
>
>>Hi everybody,
>>
>>I've designed a very complicated grid. I set all properties, headers, comments for columns, etc. Now I decided that instead of ViewPropResult I will use BldMstr as a record source and column sources.
>>
>>How can I change it but save all my work?
>>
>>Urgent!
>>
>>Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform