Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where Should Public Variables be Placed
Message
 
 
To
17/06/2013 15:30:11
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01576563
Message ID:
01576578
Views:
56
>Sorry, I didn't got that.
>
>Suppose I am getting a value say _MonthPeriod='April' and _YearPeriod=2013 from CLICK event of COMBO1 and COMBO2 in my FORM1. and Than When I press COMMAND1 some calculation is performed and REPORT FORM .... Command is executed. In My Report File I have _MonthPeriod and _YearPeriod fileds. But they are displayed blank if I dont declare _MonthPeriod and _YearPeriod as PUBLIC somewhere initially,
>
>So I am bound to declare them as Public here. Is it not so ? Also can you please Expalin(preferbly by an example) that what exactly is difference between LOCAL, PUBLIC,PRIVATE AND GLOBAL? Where and How they should be used
>
>
>
Try
local _MonthPeriod, _YearPeriod

_MonthPeriod = thisform.comboMonths.value  &&(or DisplayValue)

_YearPeriod = thisform.comboYears.value && use actual names for your comboboxes

REPORT FORM myReport ...
----------------------
Take a look at this WiKi article

http://fox.wikis.com/wc.dll?Wiki~PublicAndPrivateVariables

For 99% cases you should be able to use local variables. You rarely need global (public) variable and if you do, most likely it is an indication of the design problem.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform