External functions

  • Thread starter Thread starter Tim Jacob
  • Start date Start date
T

Tim Jacob

Is it possible to create a function library (as opposed to a class
library)? And how to you access the functions in the library?

For example, I would like to be able to call an external function that
does some sort of conversion process such as below:

Function Monday(ByVal dDay As DateTime) As Date
Return dDay.Date.AddDays(-dDay.DayOfWeek + 1)
End Function

I would pass a DateTime variable to it, and it would return the Monday
of that week.

So how do I make this available to my application(s) without having to
put it in each module?

Thanks
 
Is it possible to create a function library (as opposed to a class
library)? And how to you access the functions in the library?

For example, I would like to be able to call an external function that
does some sort of conversion process such as below:

Function Monday(ByVal dDay As DateTime) As Date
Return dDay.Date.AddDays(-dDay.DayOfWeek + 1)
End Function

I would pass a DateTime variable to it, and it would return the Monday
of that week.

So how do I make this available to my application(s) without having to
put it in each module?

Thanks

Found it. I had the functions in a Module, but had to declare the
module as "Public Module"
 
Tim --

Am 26.03.2010 15:01, schrieb Tim Jacob:
Found it. I had the functions in a Module, but had to declare the module
as "Public Module"

That should work. If you have a lot of functions, you may want to add
them to a class as shared members, similar to the 'Math' class. This
will prevent VB from automatically importing the functions.
 
Back
Top