An Enum question


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Lol didnt see Trent already answered you. I agree about modules.

1)  If you reference your project from another project, whether VB or C#, the module routines aren't accessible even if they're public.

2)  You can name a local method in a class the same as a public module routine, and the compiler won't say anything about it.  When you use the method, the compiler won't require you to prefix it; it'll just happily use the local version instead of the module with no warning.

Shared classes, on the other hand, are accessible to outside projects (if you want them to be), and shared classes avoid the ambiguity because of the prefixed class name.

StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Thanks Trent. Thanks Paul.

Trent, How is a shared class different from a regular class?

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Mike,

Your class is public but the module isn't so it is letting you know that your class is public which exposes the module which is friend. Just make the module public and it should work. Or make the class friend

Public module whatever

Paul

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Since your enum and module have not been defined as public then you cannot have a public property expose those privately typed classes.  You need to add Public in front of Module and your enum.

I do not recommend using modules!  This was left for backward compatability.  You should use shared classes.  In the case of your enum, just move it outside of the module and it will reside as its own public enum:

Public Enum MyEnum As Integer
   MyValue = 1
End Enum

StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Here is the error i'm getting:

'ParentFormID' cannot expose type 'Module1.ParentFormIDEnum' outside the project through class 'MyClass'.

Here is the related code:

Module Module1

    Enum ParentFormIDEnum As Integer
        POReceiving = 1
        Production = 4
        Returns = 5
    End Enum

End Module

Public Class MyClass

    Public WriteOnly Property ParentFormID() As ParentFormIDEnum
        Set(ByVal value As ParentFormIDEnum)
         miParentFormID = value
        End Set
    End Property

End Class

I'm not sure what this error means. All I'm trying to do is create a global enum and be able to use it in all areas of my program.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search