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:
00574096
Views:
32
This message has been marked as the solution to the initial question of the thread.
Hi James,

You have to double dots because the first dot denotes the end of the macro substitution.
  ThisForm.&lcUpdateCity..Value = ZipCity.LwrCity
  ThisForm.&lcUpdateState..Value = ZipCity.State
>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
>EndIf
>
>Select (lnOldArea)
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform