Results 1 to 3 of 3

Thread: Library of Functions in a Shared Class?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Library of Functions in a Shared Class?

    I have large group of functions that I would like to store in basically a library and simply call the functions from the controls on my forms. Back in VB 6 I would have done this with a module, but now I have been told that a Public Class is the correct way in .NET. How should I go about doing this? Any sample code of setting up a public class would be appreciated as I am new to this. Thanks in advance.

    -Jeremy

  2. #2
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Library of Functions in a Shared Class?

    The Module keyword still exists in VB.Net and behind the scenes it creates a public shared class so you are probably as well off to just use a module.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Library of Functions in a Shared Class?

    there's nothing wrong with a module in .NET... it's jsut simply a type of shared class... nothing more, nothing less. So, you can do this one of two ways. 1) Use the module. Then you can reference the functions directly, jsut as you would (DoMyFunction())... be sure to make the subs either public or friend based on your needs. 2) Add a class, then markup all your subs with Shared ... when you then access them you'll have to qualify it with the class name (myClass.DoMyFunction())

    both amount to the same thing in the end.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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