Results 1 to 4 of 4

Thread: class or module

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    class or module

    Hi

    I am using vb.net 2003. I have a class in which i have define public function for connection and many more. And in each form i have to call object for that class. I want to know that it is better to define all class function in modules. because modules not need to create an object in each form.
    Can pls guide which one is better method for memory management and better usability


    thanks

    asm

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: class or module

    Class are batter as compare to module just look the difference between the class and the module.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: class or module

    Use a class and create an instance. ADO.NET is specifically designed such that multiple connection objects are handled efficiently.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Fanatic Member Slaine's Avatar
    Join Date
    Jul 2002
    Posts
    641

    Re: class or module

    Also consider a singleton class - this is a class that is created once (when you first access it) and is then available globally under the same reference.
    Martin J Wallace (Slaine)

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