PRB: Formset.LOAD Is Not the First Event to FireID: Q129571 3.00 WINDOWS kbtool kbprb The information in this article applies to:
SYMPTOMSWhen a form set contains a Data Environment, the BeforeOpenTables event and the OpenTables method of the Data Environment are triggered before the Load event of the form set. This article explains the reason behind this implementation and offers a workaround if you want the Load event to execute before the tables are opened.
CAUSEThe Load event of a form set usually sets the environment of a form. In particular, it can be used to bind data to controls on a form. Therefore, in most cases, tables and views must be loaded before the LOAD event of a form set is executed. Thus, the OpenTables method of the data environment is, by default, called before the Load event of the form set is executed.
WORKAROUNDIf you do not want the tables or views to be opened when the Load event of a form set is executed, set the AutoOpenTables property of the form to .F.. You can then call the OpenTables method of the data environment to open the tables automatically. For example, use the following command in any method of the form:
STATUSThis behavior is by design.
MORE INFORMATIONFollowing is the sequence of events that are executed when a form set created in Visual FoxPro version 3.0 is loaded or unloaded. The order of events might differ if the form is converted from a FoxPro version 2.x screen. In this example, the form set is named FORMSET1 and contains a form named FORM1 and a data environment called DATAENVIRONMENT. This list was generated by executing the following code for the following events and methods:
NOTE: The OPENTABLES method calls the BEFOREPOPENTABLES event before the
tables are actually opened. However, the code in the event handler is
executed before the tables are opened, and this is the reason why
OPENTABLES prints before BEFOREOPENTABLES prints.
For more information about the sequence of events that are triggered when a form runs, execute the sample program called EVENTS.SCX located in the SAMPLES\CONTROLS\EVENTS directory. Additional reference words: 3.00 VFoxWin KBCategory: kbtool kbprb KBSubcategory: FxtoolFormdes
|
Last Reviewed: May 1, 1996 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |