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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I pass a field from one event to another

Status
Not open for further replies.

LeonelSanchezJr

Programmer
Jan 26, 2001
522
US
I have two fields in my INIT part of the program:

m.Alias1
m.Alias2

How can the UNLOAD portion of the program know what these variables are without declaring them PUBLIC?

 
Hello.

Create two properties in the form and fill them with the values of those variables, in INIT event.

Then, in Unload event, you should test those properties.

Hope this helps Grigore Dolghin
Class Software
Bucharest, Romania
 
HI

Grigore is right in his suggestion.
Little more thoughts....
When you say... m.Alias1 and m.Alias2...
do you mean the ALIAS of opened files ?

If that is what you want to pass on, I do not know what you are going to do with these variables. Any file opened in a form, will get closed by the firing of the DESTROY event of the form and even before the UNLOAD event fires, the aliases are closed.

And now, if what you want is just two variables.. then
create as the forms property... cAlias1 and cAlias2...
In the init event of the form...
ThisForm.cAlias1 = m.Alias1
ThisForm.cAlias2 = m.Alias2

In the UNLOAD event of the form...
RETURN ThisForm.cAlias1, ThisForm.cAlias2

Hope this helps.

ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Hi
Reading again with your title, I understand that what you want is passing of values by various events of the same form.
The form level property created as said above will help you in that. The values can be used within the form by referring.. ThisForm.cAlias1 etc...
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
You can also do the following:

Create a property on you form called:
oRecord

If you issue the following (in the unload event..what you preference is), the reocrd will be stored as an object in the property:

SELECT MyTable

SCATTER MEMVAR TO NAME THISFORM.oRecord

When you have done so, the properties of the oRecord property object can be referenced as:

oRecord.FieldName

If your table field is MyTable.MyField

oRecord.MyField would have the value of MyTable.MyField.

HTH,

Weedz (Wietze Veld)
My private project:And especially for VFP rookies:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top