Plenty of ways to do it but I'd avoid global variables if you can help it.
If we knew more about the purpose/application, I think you could get additional advice.
Typically, I have a form that is a List/Library form. User clicks on the "Add" (record) button and I launch the 2nd (MODAL!) form like this:
cmdAdd.Click code: thisform.AddRecord()
* thisform.AddRecord code: DO FORM frmNewRecord NAME loFrm NOSHOW && this form uses an object called oRecord in the form, complete with the field names I need loFrm.cMode = "ADD" loFrm.Show() && user does his voodoo here and presses either the Save or Cancel button, setting the lSaveChanges form property if loFrm.lSaveChanges then liKey = this.obiz.AddRecord(loFrm.oRecord) && will add the record and return the PKey generated (if using autoinc integer keys) endif loFrm.release this.GetRecords() && requeries list/library select (this.grd.RecordSource) locate for iid = liKey this.grd.refresh()
On 2016-07-05 20:00, Darren wrote:
Various ways.
You could pass a parameter when you create the 2nd form and pick that up in the Init of the 2nd form then set a property on the form with the object reference.
You could create the form and then set a property on the 2nd form with the object reference (depends if from is modal or not).
You could use _Screen or some other public object to hold a property with the object reference.
You could create a variable scoped public and set that to the object reference.
I am sure there are more but that should give you something to work with.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Sytze de Boer Sent: Wednesday, 6 July 2016 9:45 AM To: profoxtech@leafe.com Subject: Re: updating 2 forms
Darren, thanks for your suggestion. But I'm stuck on how to pass such a reference Can you suggest?
On Wed, Jul 6, 2016 at 11:12 AM, Darren foxdev@ozemail.com.au wrote:
Yes be the answer.
I'd probably attack it by passing a reference to the text box to be updated to the 2nd form. In the control on the 2nd form interactive change event have that set the caption of the text box on the first form to the value of the control on the 2nd form.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Sytze de Boer Sent: Wednesday, 6 July 2016 9:02 AM To: profoxtech@leafe.com Subject: updating 2 forms
Friends
In a new application I am developing, I have a Form with a Command button The Command button opens a 2nd form
When my client enters data into this 2nd form, I need to show what is being typed in a Text box on the 1st form. Can that be done?
-- Kind regards, Sytze de Boer
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]