>This is my first attempt using classes for something other than saving template forms and controls. I.m trying to save my data entry form (with DataEnvironment, I wish) as a Class. Saving the form is successful. BUT how do I reattach (So to speak) the data environment. When I issue an oTimeSheet=CreateObj('frmTimeSheet'), I get an error about the data environment missing.
>
>Please help, the documention is a bit confusing on this topic.
Normally Class doesn't contain DE, however you can add one programmatically. I don't use this way but the idea is following:
1. Create new class property 'oDE'
2. Add to Class.Load event
thisform.oDE=createobject("dataenvironment")
thisform.oDE.addobject("cursor1","cursor")
thisform.oDE.addobject("cursor2","cursor")
.....
thisform.oDE.cursor1.database="d:\vfp5test\data1.dbc"
thisform.oDE.cursor1.cursorsource="table1"
.....
thisform.oDE.opentables
2. Add to class Unload/Destroy event
thisform.oDE.closetables
this.oDE=.NULL.
Edward Pikman
Independent Consultant