Programmatically add a control to control set

I am having a difficulty adding a new control to a control set programmatically. I have a control set called btnAnswer, which in the IDE has two buttons (0 and 1) indexes. From what i have read in the documentation, it should be something like this:

dim newbutton as WebButton=new btnanswer
newbutton.left=50
newbutton.top=50
newbutton.visible=true
newbutton.caption="New button"

Theoretically, that should add a new control, which I assume would be btnAnswer(2). When this code runs, it doesn’t give any error, but the new button does not appear on the form. Also, if I try to refer to btnAnswer(2), I get an error.

Is this the right way to add a control to a control set? If so, why is the control not visible? And, how do you refer to a new control in a control set if you can’t use an index? Any help is appreciated.

Kevin Clark

[quote=145396:@Kevin Clark]I am having a difficulty adding a new control to a control set programmatically. I have a control set called btnAnswer, which in the IDE has two buttons (0 and 1) indexes. From what i have read in the documentation, it should be something like this:

dim newbutton as WebButton=new btnanswer
newbutton.left=50
newbutton.top=50
newbutton.visible=true
newbutton.caption="New button"

Theoretically, that should add a new control, which I assume would be btnAnswer(2). When this code runs, it doesn’t give any error, but the new button does not appear on the form. Also, if I try to refer to btnAnswer(2), I get an error.

Is this the right way to add a control to a control set? If so, why is the control not visible? And, how do you refer to a new control in a control set if you can’t use an index? Any help is appreciated.
[/quote]

The control set method does not work in Web Edition. Use a WebContainer where you place your button, and add the container dynamically instead.