Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Environments and Form Creation?? 1

Status
Not open for further replies.

stanmurphy

Technical User
Oct 14, 2000
89
Hello All,

I need help understanding a concept. I have two forms. On the first form, I added all the files I needed to the Data Environment to have the files available to connect to fields through the RowSource Property as I added the fields to the form.

Now, as I create my second form, do I have to add all those files to the Data Environment for THAT form for the same reason?

And if so, are both forms using the same instance of each file as far as locks, record pointers, etc??

Is this clear?
 
forms can share data if the property DataSession is set to 1 Default data session. 2 - Private data session. Creates a new data session for each instance of the form, form set, or toolbar that is created.
My preference is to use the data enviroment only to help in visual design of the form for fields and grids. Then I remove all references of tables in the environemnt. I then use the load method of the form to open tables and create any temp cursors/tables needed. Attitude is Everything
 
If you are always instantiating form 1 and than form 2, you can set the datasession of form two to that one of form one at runtime.

Both are in the same datasession, this means that both will be using the same record pointeres in the same table etc.

If you wish to have the same tables in both forms but you want both in a private datasession, you could f.i. copy the whole form and rename it to your new form.

Me personally, I don't like to use dataenvironments that are designed at design time.
I usually use classes and instantiate most forms using a private datasession in which I open my tables using a business object that handles all data logic for me.

(I sitll use VFP 6.0 by the way).

HTH,
Weedz (Edward W.F. Veld)
My private project:Download the CrownBase source code !!
 
So if my first form is 2-Private Datasession and my second form is 1-Private then my second form will use the files opened in the first form?

And after I've designed my second form I can remove the data environment and set the OpenTables and CloseTables to .F.?
 
if your first form is 2 - private, other forms are not going to be able to use the same tables. the two forms can share the tables if the forms are set to 1 - Default. Attitude is Everything
 
Danceman, that is not true.

If a forms data session is private, any form called from that form that has its data session set to public will actually share the private data sesssion of the first form.

 
Ok, I have Form1 set to Private Datasession and Form2 set to Default.

There are no tables in the Data Environment for Form2.

When I call Form2, it is not looking at the table that was selected just before the DO FORM in Form1.

Why?? I'm so confused :)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top