Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 20, 1999

Run Time Object / Control Management

Question:
Can I write statements to add/delete the control objects like command buttons at runtime like we do in java C++ ? I am under the assumption that once we populate a form with controls we cannot drop some of them alone. An alternative may be to set the visibility to false. But I don't want to do that. Is there a solution? I am sick of the staticness of the forms in VB. I am a Java programmer learning VB.

Answer:
VB6 has a Controls collection to which you can add and delete controls during run time using the Add and Remove methods. The Add method has the following syntax: Form1.Add (ProgID, name, container) The Remove method can only be used on controls that were added with the Add method. I has the following syntax:

Form1.Controls.Remove controlname
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date