>>>FOR i = 1 TO 80 >>>c='cmd'+ALLTRIM(STR(i)) >>>thisform.AddObject(m.c,'commandbutton') >>with evaluate('thisform.' + m.c) >> .visible = .t. >> && you also need to set top and left properties >>endwith >>>next>>
lnTop = 0 lnLeft = 0 FOR i = 1 TO 80 lcButtonName = 'cmd'+ALLTRIM(STR(i)) thisform.AddObject(m.lcButtonName,'commandbutton') with evaluate('thisform.' + m.c) .Top = m.lnTop .Left = m.lnLeft IF i % 3 == 0 lnTop = lnTop + .Height + 1 lnLeft = 0 ELSE lnLeft = lnLeft + .Width + 2 ENDIF .visible = .t. endwith nextNot tested :-)