Dom Sinclair Dom Sinclair - 6 months ago 4x Question

Why is this Public Function in a Module not accessible

I have an assembly comprised of several useful little utilities. Within that I have a module Containing a simple Public Function.

Module FishTrackerConfigurations

Public Function GetValueOfUseProductId As Boolean
Return VtlGetUseProductId 'A simple private routine in the same module
End Function
End Module

When I call this function from another project (in which this assembly is referenced I get the following error.

Error BC30390 'FishTrackerConfigurations.Public Function GetValueOfUseProductId() As Boolean' is not accessible in this context because it is 'Public'.

The function is being called from within my projects Application.Xaml.VB file, specifically in the Protected Overrides Sub OnStartup(e As StartupEventArgs) routine.

I'd like to know why this happens.


Although the method is Public, the Module (by default) is not.

You need to specify this explicitly:

Public Module FishTrackerConfigurations