Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add Dataenvironment to Form Programmatically
Message
De
23/10/2001 11:20:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
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:
00572071
Vues:
24
I think it is easier to open tables in Form.Load(). I don't know if there are any advantages in using the DE, apart from the OO-syntax.

Hilmar.

>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
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform