It is ok. I have managed to get work all. It was some problems not with DE class. Thanks for your opinions.
HAPPY NEW 2003. YEAR!!!!!!!!!
>Boban,
>I don't know what you mean by 'view' here.
>Anyway where you create your DE matters. Form.Dataenvironment is a property referencing to a DE object.
>
>
>oDE = createobject("BusinessDE")
>oForm = createobject("myForm",oDE)
>
>*or :
>
>define class myForm as Form
> Datasession=2
> Dataenvironment=.null.
> procedure init
> this.Dataenvironment = createobject("BusinessDE")
> endproc
>enddefine
>
>Both create and access the DE instance during init. At this point your form objects are already inited. If say a grid had 'recordsource = "customers"' it'd crash not finding the 'customers'. Then you'd need to postpone recordsource assignment to init :
>
>
>procedure init
> this.Dataenvironment = createobject("BusinessDE")
> this.myGrid.Recordsource = 'customers'
>endproc
>
>Managing a grid this way is not easy IMHO. You could initialize DE before object.init codes firing creating the instance during load :
>
>
>define class myForm as Form
> Datasession=2
> Dataenvironment=.null.
> procedure load
> this.Dataenvironment = createobject("BusinessDE")
> endproc
>enddefine
>
>
>However as Srdjan pointed out why you need to create and use this class ? If it's not frustrating for you create your forms and set their DE visually (VFP8 OTOH will provide means to use DE classes for form.DE). Tables are accessed with some lowlevel ways if in DE and loads faster than in code.
>(I don't mean not to use 'oForm = createobject("myForm") ...' vs 'do form myForm' - it's a personal preference with pros/cons).
>Cetin
>
>>I have another problem with DE class from previous message!!!!!!!!!!!!!!
>>It has passed creating instance ok, but there is a problem.
>>
>>I have Grid on Form which has View results, but the relation which has been created in that DE class doesn't work in Grid on Form (the View doesn't recognize the relation and query crash)!!!
>>Now it gets more confused to me!!!
>>
>>What is happening?!!