p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Transferring data between functions (http://p2p.wrox.com/showthread.php?t=31133)

Fightfish July 3rd, 2005 10:53 PM

Transferring data between functions
i have three PictureBoxes, background1,background2 and background3.firstly i initialise a var x=1.when the user clicks the PictureBoxes, it calls a function that changes the value of x.but when i use this var in another function, it remains as its original value.so how do i get the new value of x across to this other function?

Vano2005 July 4th, 2005 11:53 AM

you should try to use pointers
save the addres of x into pointer pX, and then just pass the pointer from function to function, so you can change the value of x through any function

planoie July 6th, 2005 12:21 PM

If you prefix C# method arguments with "ref " the argument will pass the pointer instead of an instance.


All times are GMT -4. The time now is 05:37 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.