Welcome! Log In Create A New Profile

Advanced

Windev12 - What am I doing wrong ?

Posted by robert zhong 
robert zhong
Windev12 - What am I doing wrong ?
July 16, 2008 03:56AM
Hi, Windev experts

I have following code

IntCurrentSelectedEmployeeID is int = FileContactPersons.FileEmployeeID // = 29

Intresult is int = Open(Windowxxx,IntCurrentSelectedEmployeeID ) // =18

after this code , WHY on earth IntCurrentSelectedEmployeeID =18 NOW ?

please help

robert zhong
KenKnight
Re: Windev12 - What am I doing wrong ?
July 16, 2008 04:16AM
Hi Robert,

By default a parameter is passed to a procedure by reference, this means that if the IntcurrentSelectedEmployeeID is modified in the Windowxxx, then it will be reflected in the calling procedures code. So if you modify the value of the variable in Windowxxx and then the line beneath place a trace(IntCurrentSelectedEmployeeID), it will be different (like you're seeing).


To simply pass by value, use the keyword LOCAL before the variable name in the window definition global area;

PROCEDURE Windowxxx( LOCAL nIntCurrentSelectedEmployeeID )

Hope this helps.

Cheers!
Ken



robert zhong
Re: Windev12 - What am I doing wrong ?
July 16, 2008 03:49PM
Ken, Thanks
robert zhong
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: