Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Jim Booth
  Where is Jim Booth?
 Prospect
 Connecticut - United States
 Jim Booth
 To: surinder singh
  Where is surinder singh?
 mumbai
 India
 surinder singh
Subject: RE: Variable Scoping
Thread ID: 184717 Message ID: 184759 # Views: 1 # Ratings: 0
Version: Not Applicable Category: General VFP Topics
Date: Sunday, July 20, 2008 3:32:22 PM         
   



> > 4 LOCAL - The LOCAL declaration creates the variable and assigns it a value of .F. The lifetime of a LOCAL variable is the same as that of a PRIVATE variable although the visibility is limited to only the routine that declared the variable.
> >
>
> Hi Jim,
>
> I am not agree with your local variable scope because I don't think if local variables in VFP are working in a way its definition says.
> I have declared m.ddate variable as local in this program file and assigned a value to this variable,
> then on my form modal1 i have a textbox and its controlSource is m.dDate.
> when I call this form it is showing the value of m.dDate variable whose scope is limited to my calling program module.
> And when I update value in textbox then its showing me the updated value in the calling program where this variable is declared as LOCAL.
>
> if this is the case then what about security of my LOCAL m.ddate variable?
>
>
> LOCAL m.ddate as Date 
> m.ddate = DATE() - 5
> DO FORM modal1 && have a textbox with controlsource m.ddate, change date on this form.
> WAIT WINDOW m.ddate && showing updated value from form's textbox
> RETURN 
> 


Your command DO FORM is creating an object in memory and that object's scope is to the procedure that created it which is the same scoping level as the LOCAL variable.

JimB
www.JamesBooth.com
MVP 1993-2003
Microsoft Certified Professional in VFP

ENTIRE THREAD

Variable Scoping Posted by Jim Booth @ 7/19/2008 10:42:10 PM
RE: Variable Scoping Posted by Pete Sass @ 7/20/2008 12:22:56 AM
RE: Variable Scoping Posted by Jim Booth @ 7/20/2008 2:43:27 AM
RE: Variable Scoping Posted by Andy Kramek @ 7/20/2008 3:18:26 AM
RE: Variable Scoping Posted by surinder singh @ 7/20/2008 6:02:36 AM
RE: Variable Scoping Posted by Andy Kramek @ 7/20/2008 7:40:31 AM
RE: Variable Scoping Posted by surinder singh @ 7/20/2008 7:56:44 AM
RE: Variable Scoping Posted by Andy Kramek @ 7/20/2008 11:04:53 AM
RE: Variable Scoping Posted by surinder singh @ 7/20/2008 11:44:37 AM
RE: Variable Scoping Posted by surinder singh @ 7/20/2008 11:53:24 AM
RE: Variable Scoping Posted by Andy Kramek @ 7/20/2008 3:04:16 PM
RE: Variable Scoping Posted by Jim Booth @ 7/20/2008 3:32:22 PM
RE: Variable Scoping Posted by Christof Wollenhaupt @ 7/21/2008 6:34:49 PM
RE: Variable Scoping Posted by Stefan Wuebbe @ 7/20/2008 9:26:54 AM
RE: Variable Scoping Posted by Jim Booth @ 7/20/2008 3:30:40 PM
RE: Variable Scoping Posted by Stefan Wuebbe @ 7/20/2008 4:43:45 PM
RE: Variable Scoping Posted by Jim Booth @ 7/20/2008 4:58:08 PM
RE: Variable Scoping Posted by Josip Zohil @ 7/20/2008 7:37:39 PM