problems : property with public enum type

  • Thread starter Thread starter Filip Wtterwulghe
  • Start date Start date
F

Filip Wtterwulghe

Hello,

I have have module where I have created a public enumtype that I want to
reuse in different classes .

As soon as I create a public property with this type . Vb warns me that the
'Friend' type can not be used as a public type .

Option Strict is on , so it's possible that this problem only occurs in this
case .

Is there a way to resolve this problem ?

Hoping to hear from you ...

Filip W.
 
Filip,
I have have module where I have created a public enumtype that I want to
reuse in different classes .
You have two options:

1. The Module itself defaults to Friend, change it to Public.

Option Strict On

Public Module MyModule
Public Enum MyEnum
MyValue
End Enum
End Module

2. Do not put the Enum in the Module, Enum is a Type it does not need to be
in a Module, Class, or Structure (it can be, but it doesn't have to be).

Option Strict On

Public Enum MyEnum
MyValue
End Enum

Module MyModule
End Module

Hope this helps
Jay
 
Hi Filip,

In other words a Module is not a file.

Just as you can have two or more Classes in a file, so you can have
several Modules, Enums and all the other top-level items.

Regards,
Fergus
 
Back
Top