Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add Dataenvironment to Form Programmatically
Message
De
23/10/2001 11:22:26
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/10/2001 11:18:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00572070
Message ID:
00572074
Vues:
34
>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

Tracy,
Set classlib or set procedure where it's defined (prior to VFP6). In VFP6 and later use NewObject() with parameter defining the library location.
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform