Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing table used in grid
Message
From
28/05/1998 12:51:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00102781
Message ID:
00102786
Views:
38
>I would like to change the table that that a grid edits. The two tables are very similiar and I would like to redo the grid without too much fuss.
>
>I can change RECORDSOURCE for the grid, put when I try to change the CONTROLSOURCE for a text box or combo box in the grid I get the error "Parent object will not allow this property setting for "
>
>Is there a way to do this, or must a re-create the grid (fairly complex) with the new table?
* Grid custom method changesource
lparameters cNewTableName
with this
    .recordsource = cNewTableName
    .columncount=fcount(cNewTableName)
    for ix=1 to .columncount
 	with .columns(ix)
	    .controlsource = cNewTableName+"."+field(ix)
	endwith
    endfor
endwith

* If tables are quite same and want to keep controls as is
* you should change the controlsource of column not control itself
* unless bound = .f.
***************************
* Then method changes like this
****************************
lparameters cNewTableName
with this
    .recordsource = ""
    for ix=1 to .columncount
 	with .columns(ix)
	    .controlsource = cNewTableName+"."+field(ix)
	endwith
    endfor
    .recordsource = cNewTableName
endwith
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform