Hello.
Today I've stumbled upon two problems I couldn't solve myself.
1. How can I get the structure of a dbf file (in order to make a query for creating the same table in MS SQL)
2. How can I address objects in a form by a cycle. For example
for i=1 to 10
thisform.command(i).caption = str(i)
endif
Thanks a lot in advance

Two questions (about database structure & controls)
Lars Kjetil Sørhus
if you mean how you'd address a situation like assigning captions to commandbuttons named say cmd1...cmd10, then:
for i=1 to 10
with evaluate('thisform.cmd' + ltrim(str(m.i)))
.Caption = str[m.i]
endwith
endfor
Bixler
Both suggestions are perfecct & work
shasunder
To iterate thru the objects in your form, you can loop thru the THISFORM.Controls collection:
LOCAL loControl
FOR EACH loControl in THISFORM.Controls
loControl.MessagePEMHere
ENDFOR
of course, if you want to "drill down" into the containers at the form level, you will have to construct the method where you put the above code so that it can be called recursively each time it encounters an loControl that is a container (has its own Controls collection).
Drew Speedie
VFP MVP
AdamSane
Hi!
Besides examining an array as Drew suggested, you can use Visual FoxPro's GenDBC.prg to generate the DDL for your database. Mine's in C:\Program Files\Microsoft Visual FoxPro 9\Tools\Gendbc\GenDBC.prg.