Results 1 to 9 of 9
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Library of Net code (all?)

    How do I begin to manage a library of code in VB.NET, equivalent (or close) to my habits in VBA?

    In VBA I made a Word template Utils.DOT, and in it placed all the 500 or so really(!) useful general-purpose procedures that are used throughout many Word applications. In a like manner i made a Utils.XLS/XLA for a library of useful Excel procedures.

    Now I've started in VB.NET, I'm amassing a small set of utility functions (mainly through exercise with strings, dates etc), and would like to corral them into a single place, so that I can make use of them as time goes by.

    I've seen little mention of this in the few places that seem a source of info. Is everyone re-inventing the wheel with each application?

    Typical examples (for me) in Word/VBA included sorting arrays, locating strings in arrays, parsing strings, initialising GUIs, managing data in the environment (INI file or registry), and so on. I recognise that some of these functions are directly available in VB.NET, nonetheless I anticipate slowly accumulating a library of "tricks" as I go, and I'd like to start accumulating now, rather than go back and dredge snippets out of Solutions six months from now.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Library of Net code (all?)

    I believe Visual Studio 2005 has a snippets feature built in. I imagine this can be updated and modified. That's probably the closest answer unless you can find or build an add-in that for VS 2003 that accomplishes this task.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Library of Net code (all?)

    Create a project to house those things, kind of the equivalent of your word template project. In that project, create a new class and put the code into that class. Then that project can be added to any solution where you need it without copying anything.
    Charlotte

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Library of Net code (all?)

    > Visual Studio 2005 has a snippets feature

    Thanks, Mark. I'm still new enough at this to seek confirmation that Visual Studio 2005 === VB.NET.

    I'll look for "snippets" this morning.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Library of Net code (all?)

    Thanks, Charlotte.
    I'll set up a trivial class this morning and essay with making use of it from a Solution.

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Library of Net code (all?)

    I wasn't sure if you were looking for bits of code to reuse (hence the snippets suggestion) or reusable functionality (which you'll get from Charlotte's suggestion).

    Visual Studio 2005 is currently in Beta (2). It's slated to be released sometime in Q3 this year. Visual Studio contains VB.NET, C#.NET, J#.NET, etc. - Visual Studio is all things to all programmers <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Library of Net code (all?)

    Mark, thanks for the extra response.

    I've been following my traditional route of self-taught learning by harvesting bits of code, watching them run, modifying them, and finally coercing them into useful procedures (take arguments, return results).

    It's these "finished products" I'd like to retain as I go.

    Thanks too for resolving my identity crisis regarding Visual Studio 2005.

  8. #8
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Library of Net code (all?)

    If you're after the finished products, then Charlotte's suggestion is definitely the best way to go. Maintain a project with the desired functionality, then cretae a reference to the project's output each time you need to use the functionality.

    If you want to really follow .NET practices, you can add the shared assembly (output from your library project) to the Global Assembly Cache (GAC). You'll need to assign a strongly named key to it first, then you can copy it to the GAC so that you can reference it from any project without having to point to a specific path. This will also help you with versioning as you make updates.

    The only thing you'll need to remember is that when you distribute your application you'll need to also distribute the shared assembly using a Merge Module.

    If anything I've mentioned sounds foreign, just check the MSDN library or helpfiles. You'll find everything you need in there.

    Hope this helps.

  9. #9
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Library of Net code (all?)

    Thanks, Mark. I was thinking of following my current practice - accumulating all utility code in one file, making use of it during application development (so my application template is small, but the library is huge), and delivering the source of the application and a locked library to the client.

    I'll research the sources you mention and try setting it all up.

    Thanks again.

Posting Permissions

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