• Library of Net code (all?)

    Home » Forums » Developers, developers, developers » DevOps Lounge » Library of Net code (all?)

    • This topic has 8 replies, 3 voices, and was last updated 20 years ago.
    Author
    Topic
    #419833

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #949087

      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.

      • #949449

        > 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.

        • #949466

          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 smile

          • #949468

            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.

            • #949502

              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.

            • #949549

              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.

    • #949136

      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.

      • #949450

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

    Viewing 1 reply thread
    Reply To: Reply #949502 in Library of Net code (all?)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel