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

How to pass param to another form and where to declare it

Status
Not open for further replies.

muraliambt

Programmer
Jan 22, 2002
75
US
I want activate the form2 from form1 and pass some parameters. and alos wher can i declare the varibles, so that i can access the param variables in all the methods and events fo form2.

ex.
FORM1:Click() && Button Click Event
DO FORM FORM2 WITH "Master", "Code", "Name"

Murali.


 
Hi

In the INIT of FORM2

LPARAMETERS lcParm1

* Check the presence of the parameters and whether they
* have the expected type.
*
* If ok then assign to form property.
*
IF VARTYPE (lcParm1) = 'C'
Thisform.cValue = lcParm1
ELSE
Thisform.cValue = ''
*
* And any error reporting code...
ENDIF

Hope this helps.....
 
Murali

Add three new form properties to Form2, .cMaster, .cCode, .cName

In the .Init() event of Form2 put:-

LPARAMETERS Master, Code, Name

WITH THIS
[tab].cMaster = Master
[tab].cCode = Code
[tab].cName = Name
ENDW

DO FORM FORM2 NAME oForm2 WITH "Master", "Code", "Name"

You can now access those properties by:-

oForm2.cCode = [12345]

HTH

Chris :)
 
hi,

I tried that, it worked fine, but have one more problem. I have one command button, in that click() event of the button i am accessing this .cMaster etc.. Whenever i click this button i am getting error of "varibale cMaster Not found"

I have Added this 3 property in Load() event of form2.

any suggestions.

Murali.
 
Use "thisform.cMaster" instead of "this.cMaster".

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top