# Re: 如何在Run-time时动态产生Control

Posted by ㄚ吉 on July 30, 1998 at 20:25:13:

In Reply to: 如何在Run-time时动态产生Control posted by Aaron Chiang on July 30, 1998 at 17:14:37:

: 假设我在Form中放置一个TextBox与Button,按下Button时读取TextBox的数值,并依据TextBox的数值,动态产生相同个数的CheckBox在Form上

首先将checkbox的index设为0

private sub button_click()
dim i as integer,j as integer
i = int(val(textbox.text))
if i> 0 then
for j=1 to i step 1
load checkbox(j)
with checkboc(j)
.visibled=true
.top=nnnn
.left=nnnn
end eith
next j
endif
end sub

ps:执行时只能click button一次.....为啥? 自己想想

Follow Ups: