Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating controls at runtime

Status
Not open for further replies.

ccrook

IS-IT--Management
Oct 28, 2002
1
GB
I am finding it very difficult to see how checkboxes and other controls can be placed on a form at runtime. I wish to read control names stored in a table and place a checkbox on a form for each entry in the table.

Perhaps it is not possible!

Thanks.
 
A Form is an object.
A Control is an object.


A control on a form is an item in the form's Controls collection.

THEREFORE all you have to do is add a new control object to the form's Controls collection, specifying the control object's type, top, width, height etc., etc., etc.



'ope-that-'elps

G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Hallo,

I don't think this is possible, unless you open the form in design view, create the controls, then reopen in form view.

Another (probably better) way to do it would be to create all the controls you'll ever need (say, 100) call them chkCheckBox0, chkCheckBox1, chkCheckBox2 etc. (also lblLabel0, lblLabel1 ...) and make them invisible.
Then you can manipulate them in code, making them visible as you need them. You should be able to move them in form view, just not create them.

Hope that helps,

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top