Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Steven Rebello
  Where is Steven Rebello?
 Bangalore
 India
 Steven Rebello
 To: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
Subject: RE: Retrieving variables from form
Thread ID: 179530 Message ID: 179552 # Views: 34 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Saturday, June 21, 2008 6:54:41 AM         
   



>
> * your code here
> 

> Steve
>
> > In my quest for doing away with public variables, I have created a form which has properties created where local variables are stored. I have created a method called getvar, which retrieves variables from the properties like
> >
> >
gddate=thisform.gddate
> > gnmonth=thisform.gnmonth
> > 

> > etc.
> >
> > Whenever required I need to retrieve the variables from this method by calling thisform.getvar()
> >

> > However, the variables are not retrieved, with errors obtained like "gddate not found" after issuing this command
>
> I think you may be misunderstanding something here. If the values are stored as properties on the form then you do not need to create methods to access them (you can if you wish, but you don't need to).
>
> Assuming you have your property "gdDate" and want to access its value in the code in the click of a button, all you need to do is this:
>
>
LOCAL ldDate
> ldDate = ThisForm.gdDate
> *** Now use ldDate any way you wish

>
> If you want to use a method, then in your method you must return the value:
>
>
*** FORM::GetVars Method
> LPARAMETERS tcVarName
> 
> *** Does this property name exist
> IF PEMSTATUS( This, tcVarName, 5 )
>   luRetVal = EVALUATE( "ThisForm." + tcVarName )
> ELSE
>   luRetVal = NULL
> ENDIF
> RETURN luRetVal

>
> Now you would have almost the same code in the click of your button as before, but this time you would call the method:
>
>
LOCAL ldDate
> ldDate = ThisForm.GetVars( 'gdDate' )
> *** Now use ldDate any way you wish

>
> Does that help at all?
>
> Regards
> Andy Kramek
> Microsoft MVP (Visual FoxPro)
> Tightline Computers Inc, Akron Ohio, USA



Hi Andy,

Well, recalling up to 10 variables could be quite thready, especially when the process is repetitive. Hence I had selected the method. However in the final line of your code, if you have to command
ldDate = ThisForm.GetVars( 'gdDate' )
, then it is as good as
lddate=thisform.lddate
, which also involves a lot less coding, isn't it?


Thought I'll use this opportunity to post you another question. Since access to a variable is now designated to a property value, does this mean that when a variable created by a user interface, and through a control has changed, does it have to be physically reinstated into the form's property value every time it changes?

Thanks a lot, and best regards,

Steve


Regards,

Steve

ENTIRE THREAD

Retrieving variables from form Posted by Steven Rebello @ 6/20/2008 7:22:04 PM
RE: Retrieving variables from form Posted by Borislav Borissov @ 6/20/2008 7:43:00 PM
RE: Retrieving variables from form Posted by Hugo Ranea @ 6/20/2008 8:15:04 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/20/2008 8:29:53 PM
RE: Retrieving variables from form Posted by Steven Rebello @ 6/21/2008 6:54:41 AM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/21/2008 2:22:18 PM
RE: Retrieving variables from form Posted by Steven Rebello @ 6/21/2008 6:23:13 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/21/2008 7:02:14 PM
RE: Retrieving variables from form Posted by Chad Lee @ 7/9/2008 6:00:50 PM
RE: Retrieving variables from form Posted by Cetin Basoz @ 6/21/2008 7:00:57 AM
RE: Retrieving variables from form Posted by Steven Rebello @ 6/21/2008 12:39:21 PM
RE: Retrieving variables from form Posted by Josip Zohil @ 6/24/2008 12:20:27 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/21/2008 9:50:08 AM
RE: Retrieving variables from form Posted by Steven Rebello @ 6/21/2008 12:34:12 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/21/2008 2:33:27 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/21/2008 3:10:43 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/21/2008 3:58:53 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/21/2008 5:29:44 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/21/2008 6:52:46 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 10:54:36 AM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/24/2008 11:52:39 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 12:32:42 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/24/2008 10:47:33 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/25/2008 9:58:18 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/25/2008 10:57:48 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/28/2008 8:29:32 AM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 6/28/2008 9:40:05 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/30/2008 10:25:12 AM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 6/30/2008 10:31:39 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/30/2008 10:33:22 AM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 6/30/2008 10:53:37 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/3/2008 5:42:51 PM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 7/3/2008 10:13:46 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/4/2008 10:40:34 AM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 7/4/2008 11:20:45 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/6/2008 9:42:13 PM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 7/7/2008 3:57:24 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/8/2008 1:24:19 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/7/2008 9:52:28 AM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 7/7/2008 3:04:48 PM
RE: Retrieving variables from form Posted by Jim Booth @ 7/10/2008 11:26:48 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/10/2008 4:16:43 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/28/2008 3:07:56 PM
RE: Retrieving variables from form Posted by tushar @ 6/28/2008 5:19:36 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/30/2008 10:23:13 AM
RE: Retrieving variables from form Posted by tushar @ 6/30/2008 2:14:18 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/7/2008 1:08:37 PM
RE: Retrieving variables from form Posted by tushar @ 7/7/2008 3:09:24 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/8/2008 7:02:43 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/9/2008 2:12:06 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/11/2008 10:19:21 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/12/2008 11:15:45 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/12/2008 6:15:48 PM
RE: Retrieving variables from form Posted by Jim Booth @ 7/3/2008 7:09:20 PM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 6/24/2008 12:07:31 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 2:08:18 PM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 6/25/2008 10:54:35 AM
RE: Retrieving variables from form Posted by tushar @ 6/22/2008 8:05:23 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 12:09:59 PM
RE: Retrieving variables from form Posted by Stefan Wuebbe @ 6/24/2008 5:04:09 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 5:41:33 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/25/2008 11:05:54 PM
RE: Retrieving variables from form Posted by tushar @ 6/24/2008 5:08:38 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 5:46:30 PM
RE: Retrieving variables from form Posted by tushar @ 6/24/2008 6:16:28 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/25/2008 10:15:56 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/25/2008 11:16:43 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/25/2008 11:16:58 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/27/2008 12:14:32 PM
RE: Retrieving variables from form Posted by tushar @ 6/27/2008 1:31:30 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/27/2008 8:01:14 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/7/2008 11:15:55 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/8/2008 1:21:19 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/11/2008 2:21:40 PM
RE: Retrieving variables from form Posted by tushar @ 6/26/2008 6:14:08 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/7/2008 10:06:48 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/6/2008 9:51:29 PM
RE: Retrieving variables from form Posted by Jim Booth @ 7/10/2008 3:43:00 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/11/2008 2:19:36 PM
RE: Retrieving variables from form Posted by Jim Booth @ 7/11/2008 2:43:14 PM
RE: Retrieving variables from form Posted by Tamar Granor @ 6/23/2008 10:46:10 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 12:43:59 PM
RE: Retrieving variables from form Posted by Tamar Granor @ 6/24/2008 10:50:23 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/27/2008 12:01:40 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/27/2008 8:17:11 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/30/2008 11:23:20 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/2/2008 5:07:56 AM
RE: Retrieving variables from form Posted by Jack Ryan @ 7/3/2008 1:24:37 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/6/2008 8:55:34 PM
RE: Retrieving variables from form Posted by Tamar Granor @ 6/27/2008 10:18:41 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/30/2008 11:22:43 AM
RE: Retrieving variables from form Posted by tushar @ 6/30/2008 2:12:19 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/30/2008 2:50:29 PM
RE: Retrieving variables from form Posted by tushar @ 6/30/2008 3:27:52 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/30/2008 3:58:55 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/6/2008 9:21:45 PM
RE: Retrieving variables from form Posted by Jim Booth @ 7/3/2008 5:34:34 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/3/2008 5:55:57 PM
RE: Retrieving variables from form Posted by Jim Booth @ 7/3/2008 7:16:55 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/7/2008 11:44:56 AM
RE: Retrieving variables from form Posted by Jim Booth @ 7/9/2008 10:20:59 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/11/2008 2:05:45 PM
RE: Retrieving variables from form Posted by tushar @ 7/10/2008 1:54:08 PM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/10/2008 4:25:04 PM
RE: Retrieving variables from form Posted by tushar @ 7/10/2008 9:00:26 PM
RE: Retrieving variables from form Posted by Jack Ryan @ 7/3/2008 1:54:15 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/3/2008 5:45:14 PM
RE: Retrieving variables from form Posted by Jack Ryan @ 7/4/2008 3:18:07 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 7/7/2008 11:49:41 AM
RE: Retrieving variables from form Posted by Jim Booth @ 7/3/2008 7:22:26 PM
RE: Retrieving variables from form Posted by Jack Ryan @ 7/4/2008 3:15:25 AM
RE: Retrieving variables from form Posted by Jim Booth @ 6/24/2008 6:58:28 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/24/2008 1:13:04 PM
RE: Retrieving variables from form Posted by Jim Booth @ 6/24/2008 6:00:41 PM
RE: Retrieving variables from form Posted by Hugo Ranea @ 6/24/2008 7:13:38 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/24/2008 10:57:29 PM
RE: Retrieving variables from form Posted by Hugo Ranea @ 6/24/2008 11:46:07 PM
RE: Retrieving variables from form Posted by Hugo Ranea @ 6/25/2008 12:00:11 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/25/2008 11:12:35 PM
RE: Retrieving variables from form Posted by Jim Booth @ 6/25/2008 4:58:32 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/25/2008 11:14:20 PM
RE: Retrieving variables from form Posted by Hugo Ranea @ 6/26/2008 7:43:31 PM
RE: Retrieving variables from form Posted by Jim Booth @ 6/26/2008 8:02:39 PM
RE: Retrieving variables from form Posted by Hugo Ranea @ 6/26/2008 8:36:38 PM
RE: Retrieving variables from form Posted by Andy Kramek @ 6/26/2008 11:33:33 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 6/27/2008 12:43:19 AM
RE: Retrieving variables from form Posted by Samir Ibrahim @ 6/27/2008 12:49:00 PM
RE: Retrieving variables from form Posted by Tom Saddul @ 6/30/2008 12:42:49 PM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/6/2008 9:32:28 PM
RE: Retrieving variables from form Posted by Tom Saddul @ 7/7/2008 11:53:16 AM
RE: Retrieving variables from form Posted by Mike Yearwood @ 7/8/2008 1:21:52 AM
RE: Retrieving variables from form Posted by Glenn Villar @ 7/8/2008 3:04:17 PM
RE: Retrieving variables from form Posted by Jim Booth @ 7/10/2008 9:24:32 PM