An Enum question


Author
Message
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.

Replies
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
And here's where my VB6 brain  is having trouble... I dont understand how I can place the enum 'outside' of the Module.

I've seen examples like this:

Public Class Item

End Class

Public Class Inventory

    Dim itm as new Item

End Class

I dont understand how you can have two classes in the same file. I am under the impression that you can only have one class per file.  What gives? Tongue

P.S. I really appreciate this thread and the advice on using a shared class instead of a module... that is invaluable information that I might not otherwise pickup. Cool

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can have as many classes in a file as you want... you can even have nested classes.  Basically, with VB.NET, you can have a 1 file to 1 class relationship, or you can have a multiple file to 1 class relationship (partial classes... part of the class exists in each file), or you can have a 1 file to multiple class relationship.  The code file does not define a class... the Public Class <ClassName> and End Class do.  Open up one of the .designer.vb files for one of your business objects and drop down the left combo box at the top of the file... you'll see how many classes exist in that one file.  And besides the business object, they're all nested.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
StarkMike - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Paul Chase - 19 Years Ago
Paul Chase - 19 Years Ago
StarkMike - 19 Years Ago
StarkMike - 19 Years Ago
StrataFrame Team - 19 Years Ago
Ivan George Borges - 18 Years Ago
Trent L. Taylor - 18 Years Ago
                         No, Ivan, you can have as many Imports as you want... they don't...
StrataFrame Team - 18 Years Ago
                             Thanks guys, got the idea.
Ivan George Borges - 18 Years Ago
                                 Anything for you, Ivan :D
Trent L. Taylor - 18 Years Ago
StarkMike - 19 Years Ago
StarkMike - 19 Years Ago
StrataFrame Team - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search