Welcome to mibuso.com

mibuso account = Forum account

To login to mibuso.com, you need a forum account. The same forum account is used through the site.

Don't have a forum account yet?

Please register yourself first in the forum: registration

Member Login

Lost your password?

20 May 2013
 Home | Forum | Downloads | Business Directory | Product Directory | How Tos | Blogs | Jobs Feedback 
Become a sponsor
Our sponsors

How Tos

How To pass parameters between objects (forms, reports, ...)?

Author: Luc Van Dyck

This example uses 2 forms:

- Form1 asks for a name and two decimal values

- After clicking the "Call Form2" button, these variables are passed to Form2, where they are displayed.

- After clicking the "Return to Form1" button, focus is placed again on Form1 and the result of the calculation (decimal1 + decimal2) is displayed.

This is the code behind the "Call Form2" button of Form1. Form2 is defined as a variable (frmForm2), otherwise it isn't possible to call the functions on that form.
OnPush()
CLEAR(frmForm2);
frmForm2.fctSetName(txtName);
frmForm2.fctSetDecimal1(decNumber1);
frmForm2.fctSetDecimal2(decNumber2);
decResult := 0;
IF frmForm2.RUNMODAL = ACTION::Close THEN BEGIN
  decResult := frmForm2.fctGetResult;
END;

Here are the functions of Form2, which accepts the parameters and returns the result of the calculation. The parameters are stored in global variables, so they can be used in the form.
fctSetName(ptxtName : Text[30])
//fctSetName

txtName := ptxtName;

fctSetDecimal1(pdecNumber1 : Decimal)
//fctSetDecimal1

decNumber1 := pdecNumber1;

fctSetDecimal2(pdecNumber2 : Decimal)
//fctSetDecimal2

decNumber2 := pdecNumber2;

fctGetResult() : Decimal
//fctGetResult

EXIT(decNumber1 + decNumber2);

The same idea can be used to transfer some data to a report or dataport.

 

 Download code

Author: Luc Van Dyck
Date: 26/05/2003
Size: 4.9 KB
Downloads: 2304
Views: 11363  (Page views are only logged since 3 May 2005)
 
Avg. rating:  (rated 48 times)
 
Discuss this How To in the forum (3 reactions)
 
What's this MUID? [MUID:ALYH]  SMS this title to a friend
 Mail this title to a friend
 
Rate this HowTo
 
- Please do not vote for the same HowTo more than once.
- Please be objective.
   poor



   excellent



Copyright © 1999-2013 mibuso.com. All rights reserved. About | Link to us | Recommend it! | Disclaimer
mibuso.com is not in any way affiliated or associated with Microsoft Corporation or any of the companies in the Microsoft Corporation Group.