Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add Dataenvironment to Form Programmatically
Message
 
 
To
23/10/2001 11:18:32
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00572070
Message ID:
00572077
Views:
39
Do you really need to do it through DataEnvironment? I usually open tables (views) programatically in Form's Load. If some table could not be opened, I return .f. from Load.

>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
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform