Results 1 to 3 of 3

Thread: How to re-use code.

  1. #1
    Guest

    Post

    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.

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    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.

  3. #3
    Hyperactive Member onerrorgoto's Avatar
    Join Date
    Aug 1999
    Location
    Sweden
    Posts
    330

    Post

    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)
    [email protected]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width