Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newobject(..., 'column') errors when building a grid
Message
From
03/05/2004 11:40:13
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Newobject(..., 'column') errors when building a grid
Miscellaneous
Thread ID:
00900417
Message ID:
00900417
Views:
53
I have a grid with no columns - they were added programmatically in the grid's .init, using code like this:
this.Newobject("colRsd_itemno","column")
This has worked without a hitch at runtime. Then I decided I can't maintain the widths manually forever, and decided to apply this same code to the grid once at design time. I've copied the code into a temp.prg, aselect()ed the grid and passed it as a parameter to a little prg, which looked like this
Lparameters o
With o
	.Newobject("colRsd_itemno","column")
The error I got sounds like a very wrong error:

You may not change the RecordSource of a BROWSE object.
(Error 1772)
The browse object must remain aligned with its table.

You tried to change the RecordSource property programmatically.
To browse a different table, close the current browse and browse the new table. For more information, see BROWSE or RecordSource.


It persisted even when I tried it on a completely blank grid with no recordsource at all. I had to tweak the code to
Lparameters o
With o
	.columncount=8
	* column 1
*	.Newobject("colRsd_itemno","column")
	.columns[1].name="colRsd_itemno"
to get it to work, and it worked perfectly then.

So I'm puzzled - why would .newobject({name}, "column") be OK at runtime, and bang with such a silly error code at design time.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Next
Reply
Map
View

Click here to load this message in the networking platform