Subject Re: pass a value from fora ONE to be read by form TWO
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Sat, 10 Aug 2019 21:35:34 -0700
Newsgroups dbase.getting-started

On 8/10/2019 1:22 PM, Ivan Benttini wrote:
> How can I pass a value from form One to be tested by form Two.
> I am running Microsoft Windows 7 and my dBase version is 2.80.
>
> I tought that by using a global variable like _app.VALUE NAME would do the trick but is not working for me. Can some one give me a "push" here?
>
> May be a snip of code would be Much appreciate when anyone have the time.
>


This is easier than it might seem, but I use custom properties of the
forms, rather than trying to use _app values. (Also a bit of work, but
it's not that bad once you understand how to do it ...)

If you have, say, a pushbutton on the first form that opens the second:

     function MyButton_onClick
        set procedure to second_form.wfm
        oSecond = new second_formform() // classname in the .wfm file
        oSecond.MyCustomProperty = some_value // for example,
          // form.entryfield11.value -- or whatever you need
        // open or readModal:
        oSecond.open()
     return

In the second form, in say, an overridden open method:
     function form_open
        if type( this.MyCustomProperty ) # "U" // not undefined
           // assign value to a text control for display ...
           form.MyText1.text = this.MyCustomProperty
        endif
     return

This is just a simple example, untested, but based on things I have done
MANY MANY times.

Ken

--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm