External functions

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

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

Herfried K. Wagner [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top