creating a vb code file to hold all functions

Hi,

I want to create a visual basic code file that I can place all my functions in so that all my programs can use this one file instead of including the function in each webpage, etc...similar to a #include file for C++.  How do you do that in Visual Basic .NET



Answer this question

creating a vb code file to hold all functions

  • chribonn

    You cannot do that and you don't really need to. You need to make a class library project, put your code in there and add a reference to that class library into your web projects.

     


  • Michael Pang

     

    Its an over simplification but hopefully you get the idea...yopu statemnts are correct!

    Use the imports statement like this

    Imports MyFunctions

    Public Class MyClass

    Public Function WhatEver()as Whatever

    return testFunction

    end function

    end class

     

     



  • sewyew

    I think that if you use a public module instead of a public class you won't need to write Myfunctions.testfunction, just testfunction.

     


  • Giri12

    How would the individual functions be added to the class library

    Do you create a Public class Myfunctions

    And then you have to call the function after an import like Myfunctions.testfunction   How do you make it so you only have to call testfunction

    Dean

  • creating a vb code file to hold all functions