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

Return a value from a class form

Status
Not open for further replies.

kprogrammer

Programmer
Feb 28, 2003
27
0
0
We are working class forms (classes that are subclassed from the base class "form") and I need to return values to from them to calling programs/classes. We are working in VFP8. I know that I can use public variables, cursors or an object reference passed as a parameter (then update the properties of the associated object).

I would like to know if anyone has any other ways to return values from these "class forms". Some method that wouldn't require coding in the form to "know" the calling object's properties names or the names of public variables.

Thanks

Kirk
 
If you can make them modal you can use
Do form whatever with whatever to variable. The unload of the form return the value you want and the calling variable will hold it's value.
 
As JRudisill says, you can return a value from a modal form called with DO FORM. However, there's no way to directly return a value from a form instantiated from a class. One alternative is to store the value in a property of the form and hide, rather than close, the form. Then close it in code after you've retrieved the value you need.

Tamar
 
As Tamar says, I can't use the "DO FORM" command since these forms are instantiated from classes. I like the hide form idea and will try this since only the calling object will need to know the objects ids in the called form. (No hard coded ids referring back to the calling object in the called class form)

I keep thinking there must be an easier way, such as the return variable in "DO FORM" call.

Thanks for the feedback!

Kirk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top