Click to See Complete Forum and Search --> : How to re-use code.
What is the best way to re-use code; put it into a module or a class module or as I read on here a template? I don't use VB more because I get frustrated when starting a new project because I seem to have to start from scratch everytime, because I can't find the code I sweated over previously.
netSurfer
Jan 11th, 2000, 09:43 PM
What I do is seperate most of my code into functions, at least the more common stuff. I'll put a lot of the common declarations, global variables and these functions into a couple modules (.bas) fies. Usually one called Global and one called Common. Then I can just load these into what ever project I create. It definetly makes it easier. I think it's a personal preference thing though. I don't use classes at all so I don't know whether that would be better. Hope this helps.
onerrorgoto
Jan 12th, 2000, 11:47 AM
I on the otherhand do it the "Hard" way ;)
I use copy/paste into NotePad and then I name the file with a very god and describing name like "Fade the Background" or "Save_SaveAs_Open Files" etc.
It might not be the best way but It is easy to search for a specific function/code.
Find your own way.
I have a friend who made a DB and saved all code into that and put gave each item a description witch he could search for.
I have also seen an Add-In for VB where you can mark the code you want to save and then rightclick and choose save and give the code a name. You use the same way to input code, just rightclick and choose Input or something. The sadest part is that I have forgotten the name of that Add-In and I dont know where I found it :(
------------------
On Error Goto Bed :0)
anders@zsystemdesign.se
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.