Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reference DE of Form
Message
From
01/05/2003 13:21:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/05/2003 12:57:54
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00783748
Message ID:
00783765
Views:
16
This message has been marked as the solution to the initial question of the thread.
>Hi all,
>
>How can I reference the default DataEnvironment of a form? The VFP8 help for DataEnvironment object left me to believe I can do it this way but this does not work:
>
>oForm = createobject('form')
>? oForm.DataEnvironment.Name
>
Ramil,
If you use CreateObject() form doesn't have a dataenvironment object (It's a property referencing to an object).
Public oForm
oForm = Createobject('form')
oForm.AddProperty('Dataenvironment',Createobject('Dataenvironment'))
With oForm.DataEnvironment
    .CloseTables
    .Newobject('Cursor1','cursor')
    .Cursor1.Database = 'c:\myPath\testdata.dbc'
    .Cursor1.CursorSource = 'employee'
    .Cursor1.Alias = 'myEmp'
    .OpenTables
Endwith
With oForm
    .Newobject('grid1','grid')
    .Grid1.RecordSource = 'myEmp'
    .Grid1.Visible=.T.
    .Show
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform