Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reference a control with the value of a variable
Message
 
 
To
26/10/2001 20:30:20
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00574091
Message ID:
00574105
Views:
30
>Hi All,
>
>I've seen this done somewhere before but I can't seem to put 1 and 1 together. How do you reference an object using the value of a variable? I'm kind of recalling something like double-dots ThisForm..cControlName.Value..??? I'm not really sure.
>
>Here's some background of what I'm trying to do. I have two address blocks on my form, one for the mailing address and one for the residence address (they may be different). I have a simple method that looks up the city and state based on the zipcode provided. I want to pass the method either "MAIL" or "RES" to determine which controls to update the residence or mail.
>
>Thanks in advance for all your help.
>
>Aloha,
>
>James
>
>Here's a sample of what the code looks like:
>************************************************************
>** ZipLookup(96792, "MAIL")
>************************************************************
>
>LParameters tcZip, tcResOrMail
>
>Local lcCity, lcState, lnOldArea
>
>lcCity = ""
>lcState = ""
>lnOldArea = Select()
>
>Select ZipCity
>Locate for Zip = tcZip
>If Found()
>  lcUpdateCity = "txt" + tcResorMail && Build control name???
>
>  *!* Here's where my prolem is
>  *!* This doesn't work and I can't remember what will
>  *ThisForm.&lcUpdateCity..Value = ZipCity.LwrCity
>  *ThisForm.&lcUpdateState..Value = ZipCity.State
  <b>
   store ZipCity.LwrCity to ('thisform.'+m.lcUpdateCity+".value")
   store ZipCity.State to ('thisform.'+m.lcUpdateState+".value")</b>
>EndIf
>
>Select (lnOldArea)
>
Hi James,

Sergey answered your question, but you don't need macros at all. See my changes in bold.
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