Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a DE to a classed-form
Message
 
 
À
14/10/2003 09:55:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00838513
Message ID:
00839347
Vues:
19
>Hello,
>
>I know this is extremely easy to do in VFP8, but is there a way to do it in VFP6sp5?
>
>I create a form with createobject(), of course it has no dataenviroment. I want to add one... is it possible ?
>
>Thanks

Pablo,
Here is one example:
MYDE.PRG
define class DE as DataEnvironment
AutoOpenTables = .F.
AutoCloseTables = .F.

add object Cursor1 as Cursor with ;
   Database = 'MyDBC.DBC', ;
   CursorSource = 'MyTableName', ;
   Name = 'Cursor1'

procedure Init
THIS.OpenTables()
endproc

procedure Destroy
THIS.CloseTables()
endproc

procedure Release
release THIS
endproc
enddefine
Then in the Form methods:
Load Method
local loDE
loDE = newobject('DE','MYDE.PRG')
THIS.AddProperty('DE',loDE)

Destroy Method
THIS.DE.Release()
You won't be able to modify the DE visually or use the implicit control binding functionality unless you use VFP 8 but this works.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform