Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Browse view
Message
De
17/11/2003 16:54:23
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
17/11/2003 16:41:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00850468
Message ID:
00850776
Vues:
19
>hi ,
>sorry maybe I didn't understand you, but what I need is how can I add table or view like CLIENT table to data enviroment in the form by code ?
>
>thank you for your time.

I don't know how to add it to the data environment, but if you put it in the Load() event, the effect is similar. You will use the Load() event, because it is executed before the Init() of the objects contained in the form. Form.Init() would be too late.

So, if I need a table CLIENT in a class, and in forms (or form classes) derived from that class, instead of putting it into the form's DataEnvironment (which, is not available for a form class - at least, not until version 8), I put code in the Form.Load() event.

Let's suppose your table is called "Client", and you want to sort by a field "LastName". Put the following code into your Form.Load() event:
use client order LastName
If you need to open more than one table, each has to be opened in a different work area; for instance:
use client order LastName in 1
use invoice order InvoiceDate in 2
In practice, it is preferable to have VFP search for a free area automatically; you do this by specifying work area 0. The above example changes to:
use client order LastName in 0
use invoice order InvoiceDate in 0
These commands are the same you would use within a PRG, to access a table programmatically.
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