Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Victor Espina
  Where is Victor Espina?
 Rancagua
 Chile
 Victor Espina
 To: Cecil Champenois
  Where is Cecil Champenois?
 Little Elm
 Texas - United States
 Cecil Champenois
 Tags
Subject: RE: Loop through and rename labels
Thread ID: 416077 Message ID: 416175 # Views: 42 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Tuesday, December 23, 2014 1:05:58 AM         
   


Yet another way to avoid macro substitution in this case:

FOR x = 1 TO 10
  cIndex = ALLT(STR(x))
  oLabel = GETPEM(THISFORM, "lblTruckNumber" + cIndex)
  oLabel.Caption = "THis is label " + cIndex
ENDFOR


Victor

> >
> > Hi Cecil
> >
> > This is one of those times where & should send up red flags. It's slow as all get out. The better way is:
> >
> >
For x = 1 to 10
> >    store 'This is label'+alltrim(str(m.x)) to ("thisform.lblTruckNumber" + alltrim(str(m.x)) + ".caption")
> > endfor 
> > 

> >
> >
> >
> > Mike Yearwood
> > Microsoft MVP Visual FoxPro 2008, 2009
> > We have enough youth. We need a fountain of smart!
> > There may be many ways to skin a cat, but there are very few right ways to do it.
>
> Hmmm, might be a bit faster. I do understand that macro expansion is slow.
> Thanks!
>
> Cecil Champenois, Jr.



/* ---------------------------------- *\<br />Victor J Espina S
www.victorespina.com.ve/wiki
"Change is the only constant in the Universe"

ENTIRE THREAD

Loop through and rename labels Posted by Cecil Champenois @ 12/21/2014 12:23:21 AM
RE: Loop through and rename labels Posted by Ali Koumaiha @ 12/21/2014 4:02:23 AM
RE: Loop through and rename labels Posted by Cecil Champenois @ 12/21/2014 4:31:08 AM
RE: Loop through and rename labels Posted by Stefan Wuebbe @ 12/21/2014 7:09:36 AM
RE: Loop through and rename labels Posted by Ali Koumaiha @ 12/21/2014 12:34:19 PM
RE: Loop through and rename labels Posted by Cecil Champenois @ 12/21/2014 4:18:53 PM
RE: Loop through and rename labels Posted by Mike Yearwood @ 12/22/2014 3:35:51 PM
RE: Loop through and rename labels Posted by Cecil Champenois @ 12/22/2014 4:58:32 PM
RE: Loop through and rename labels Posted by Victor Espina @ 12/23/2014 1:05:58 AM
RE: Loop through and rename labels Posted by Bernard Bout @ 12/24/2014 4:19:23 AM