>>WITH thisform >> LOCAL visible_val, loopcnt, arraycnt >> visible_val = '' && hold visible value of option button >> loopcnt = 1 && loop counter >> arraycnt = && array counter >> >> DIMENSION gaMyArray(1,5) >> gaMyArray(1,1) = 5 >> gaMyArray(1,2) = 54 >> gaMyArray(1,3) = 125 >> gaMyArray(1,4) = 237 >> gaMyArray(1,5) = 345 >> DO WHILE loopcnt <= 5 && have 5 option buttons in optiongroup >> >> visible_val = thisform.+"Optiongroup1.option"+loopcnt+".visible" >> IF visible_val = .t. >> arraycnt = arraycnt + 1 >> thisform.+"Optiongroup1.option"+loopcnt+".left" = gaMyArray(1,arraycnt) && sets the next .left value >> ENDIF >> loopcnt = loopcnt + 1 >> ENDDO >>ENDWITH >>>>
>for each loOption in thisform.OptionGroup1.Buttons > if loOption.visible = .t. > loOption.left = > endif >nextHi Naomi, thanks for replying back. Never really used a for...each before. I tried the following:
arraycnt = 1 && array counter DIMENSION gaMyArray(1,5) gaMyArray(1,1) = 5 gaMyArray(1,2) = 54 gaMyArray(1,3) = 125 gaMyArray(1,4) = 237 gaMyArray(1,5) = 345 for each loOption in thisform.optiongroup1.Buttons if loOption.visible = .t. loOption.left = gaMyArray(1,arraycnt) arraycnt = arraycnt + 1 endif nextbut it says:
Unknown Member OPTIONGROUP1
optiongroup1 control is on my form.