473,549 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problems : property with public enum type

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.
Nov 20 '05 #1
2 3216
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

"Filip Wtterwulghe" <fi******@c3.be > wrote in message
news:3f******** *************** @reader0.news.s kynet.be... 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.

Nov 20 '05 #2
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
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
24871
by: Kevin Auch | last post by:
Hi, I try to declare a property which is an enum type, but i doesn't works, I get the following message : "Inconsistent accessibility: property type 'eType' is less accessible than property 'Type' " my code : enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};
0
1030
by: davesauny | last post by:
Hi guys, I'm having trouble with serialization especially of array elements! What I have is an array of clsUsers which have various properties as shown in the code below The XML I want to achieve is shown at the top and underneath that is the xml i have achieved.... any help you can provide would be most helpful!
6
4815
by: Bob | last post by:
It should be simple, but I'm stuck on this one... how do you return a value for an enum property type? TIA, Bob
0
5552
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control is used to view the state of the running jobs and schedule new jobs. The control also runs in the context of Internet Explorer (we do this so the...
62
2954
by: djake | last post by:
Someone can explain me why to use property get and property set to access a value in a class, insted of access the value directly? What's the usefulness of property statements in VB.NET? Thanks
0
1499
by: student | last post by:
In Summary: Create an object - dont set one of its Enum Type properties and make sure it does not appear in XML Object Serialization. Strings function as hoped for but Enums do not Heres my problem broken down to simplest form I have the following ENUM ----------------------------------------------
4
4031
by: Pritcham | last post by:
Hi all I've got a number of classes already developed (basic entity classes) like the following: Public Class Contact Private _firstname as String Private _age as Integer Public Property FirstName As String
3
1208
by: Tom C | last post by:
I need to expose a property as a list in the designer properties. Somthing like Friend Property MyControlChoice as system.string get return me._myControlChoice end get set value as system.string me._myControlChoice = value end set
6
1459
by: Rick | last post by:
Hi group, I'm trying to inherit from the windows checkbox control. This is no problem. My goal is to add a property that is based on an enum. When I have an enum declared within the class, it works correctly, however, my enum is declared in a referenced assembly. The form cannot load the enum from the referenced assembly, it indicates that...
0
7527
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7967
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7485
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7819
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5097
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1953
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.