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
Jan 11, 2000

Copying Controls From Form to Form

Question:
I have a VB application that contains two forms. Form A is a Control Library that contains several Frames, Labels, Text Boxes, and Command buttons. (Note: some of these controls are third party controls.) Form B is the Main form. This form contains an SSActiveTab, with 4 tabs on it.

What I want to do is make it so that the user selects on tab 1, building a data entry form on tab 2. I know how to collect the desired controls from the Control Library, but how do I paint them onto the Main form tab?

Answer:
In VB6 a Form has a Controls collection which you can add to by passing the progid of the control. If you want to add a control that is not in the control box of the application and you want be able to catch events of the control, then declare a variable as VBControlExtender and set it to point to the control that you added:

Dim objNewControl as VBControlExtender

Set objNewControl=Controls.Add   ("Widget.Thingjet","Widget1")
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