dcsimg
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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Copying Controls and Code

Question:
Is there a way to easily copy all the event code for a control from one form to another or even within the same form. As an example I have a datagrid with a bunch of event routines. I want to create another grid (on another form in a different app) with all the same routines. It seems like there should be a better way than manual cut and paste.

Answer:
I have no idea why it works like this, but it seems that they still haven't fixed this behavior. You might try this:

  1. In Visual Basic, copy the controls to the new form. Make sure they are all named the same as on the source form.
  2. Make sure the original form is saved in Text Format.
  3. Open both Forms in Notepad or WordPad and manually copy all of the appropriate code. It's quicker than VB. You can also, in VB 4, select Full Module View from the Options screen to get essentially the same view that Notepad gives you.
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