dbTalk Databases Forums  

VFP 7.0 - Need help with 'Return' value from a Form

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss VFP 7.0 - Need help with 'Return' value from a Form in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ShahJagat
 
Posts: n/a

Default VFP 7.0 - Need help with 'Return' value from a Form - 09-22-2003 , 12:28 AM






Hi -


I am working on migrating a FPW 2.6 application to VFp. I am very new at VFP.

I am trying to create a form that would return a value that the user inputs
into a text box.

Myform window type property is set to Modal.

Do form' Myform.scx' to cUserValue

In the form, I have a Text box. 'Text1'. The user enters a value into this text
box. In the valid event of the text box I have

:Text1.valid:

lretval=This.value

In the unload event of the form, I have the following line of code.

*form unload()
Return lretval.

This does not work. When I look at the trace window, it runs into an error at
the line 'Return lretval

For whatever reason the 'lretval' is not visible at the form unload() event.

What am I dong wrong? I am ready to tear my hair out. The only way I could
make this work is by declaring lretavl as a Public variable in the 'Init' event
of the form. But I am sure that is not the right way of doing this. Can someone
explain to em what am I doing wrong.?

Thanks in advance.


Shah








Reply With Quote
  #2  
Old   
Stefan Wuebbe
 
Posts: n/a

Default Re: VFP 7.0 - Need help with 'Return' value from a Form - 09-22-2003 , 01:41 AM






In Vfp variables' scope ends together with the current method/
procedure by default (which makes sense because of the OOP
encapsulation concept).
You can use a custom property instead - e.g in the Vfp IDE
menu -> Form -> New Property, then you can bind it to your
textbox by typing "Thisform.YourNewProperty" (w/o quotes)
in the textbox.ControlSource property.


hth
-Stefan

"ShahJagat" <shahjagat (AT) aol (DOT) com> schrieb im Newsbeitrag
news:20030922012819.19859.00001396 (AT) mb-m28 (DOT) aol.com...
Quote:
Hi -


I am working on migrating a FPW 2.6 application to VFp. I am very new at
VFP.

I am trying to create a form that would return a value that the user
inputs
into a text box.

Myform window type property is set to Modal.

Do form' Myform.scx' to cUserValue

In the form, I have a Text box. 'Text1'. The user enters a value into this
text
box. In the valid event of the text box I have

:Text1.valid:

lretval=This.value

In the unload event of the form, I have the following line of code.

*form unload()
Return lretval.

This does not work. When I look at the trace window, it runs into an error
at
the line 'Return lretval

For whatever reason the 'lretval' is not visible at the form unload()
event.

What am I dong wrong? I am ready to tear my hair out. The only way I
could
make this work is by declaring lretavl as a Public variable in the 'Init'
event
of the form. But I am sure that is not the right way of doing this. Can
someone
explain to em what am I doing wrong.?

Thanks in advance.


Shah









Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.