Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing grid's RowSource in Design-time
Message
De
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:
00674846
Vues:
37
This message has been marked as a message which has helped to the initial question of the thread.
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform