Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add Dataenvironment to Form Programmatically
Message
From
23/10/2001 11:18:32
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Add Dataenvironment to Form Programmatically
Miscellaneous
Thread ID:
00572070
Message ID:
00572070
Views:
97
I typically use the dataenvironment to add tables to my forms, but in this case I need to do it programmatically. I have a public variable 'ddir' which points to the correct path of the tables and it is in scope at this time (I checked). I am trying to add tables to the dataenvironment of my form in the form's init method using the following code:

Thisform.Addproperty("oDataenv", Createobject("Loadtables"))
This.oDataenv.AutoOpenTables=.F.
This.oDataenv.AutoCloseTables=.F.

This.oDataenv.AddObject("Cursor1", "Cursor")

With This.DataEnvironment.Cursor1
.Alias = "PRNTCODE"
.CursorSource = ddir+"PRNTCODE.dbf"
.Order = "p_name"
EndWith

This.oDataenv.AddObject("Cursor2", "Cursor")
With This.DataEnvironment.Cursor2
.Alias = "CONTROL"
.CursorSource = ddir+"CONTROL.DBF"
.Order = "cn_name"
EndWith

This.oDataenv.AddObject("Cursor3", "Cursor")
With This.DataEnvironment.Cursor3
.Alias = "CTRLSET"
.CursorSource = ddir+"CTRLSET.DBF"
.Order = "cn_name"
EndWith

This.oDataenv.OpenTables()


However, when I do this, I get the error "Class Definition Load Tables is Not Found." It's been a while since I added cursors to a form programmatically, but I think this is how I did it in the past. Can anyone notice what's missing in my code?
Thanks to all in advance!
Tracy
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform