473,785 Members | 3,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange cannot expose a Friend type error

I have a project with the following module:

Module mdlDeclarations
Public Enum getMethod
gmFirst
gmLast
End Enum
End Module

and the following class:

Public Class clsTest
Public Function xyz(ByVal a As getMethod) ' Error
End Function
End Class

I made this class simply with Project|Add Class.

I get an error for argument a of the function xyz:
'a' cannot expose a Friend type outside of the Public
class 'clsTest'.

When I put clsTest inside a module it works fine:

Module mdlTest
Public Class clsTest
Public Function xyz(ByVal a As getMethod) ' No error!
End Function
End Class

End Module

Any ideas what is going on?

Nov 20 '05 #1
2 7920
"Gerard Stafleu" <ge****@uwo.c a> schrieb:
I have a project with the following module:

Module mdlDeclarations
Public Enum getMethod
gmFirst
gmLast
End Enum
End Module

and the following class:

Public Class clsTest
Public Function xyz(ByVal a As getMethod) ' Error
End Function
End Class

I made this class simply with Project|Add Class.

I get an error for argument a of the function xyz:
'a' cannot expose a Friend type outside of the Public
class 'clsTest'.

When I put clsTest inside a module it works fine:

Module mdlTest
Public Class clsTest
Public Function xyz(ByVal a As getMethod) ' No error!
End Function
End Class

End Module

Any ideas what is going on?


http://www.google.de/groups?selm=%23...TNGP10.phx.gbl

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2
"Gerard Stafleu" <ge****@uwo.c a> schrieb
I have a project with the following module:

Module mdlDeclarations
Public Enum getMethod
gmFirst
gmLast
End Enum
End Module

and the following class:

Public Class clsTest
Public Function xyz(ByVal a As getMethod) ' Error
End Function
End Class

I made this class simply with Project|Add Class.

I get an error for argument a of the function xyz:
'a' cannot expose a Friend type outside of the Public
class 'clsTest'.

When I put clsTest inside a module it works fine:

Module mdlTest
Public Class clsTest
Public Function xyz(ByVal a As getMethod) ' No error!
End Function
End Class

End Module

Any ideas what is going on?

In the first example, the Module is declared as "Friend" whereas the class
and it's function is public. As the module is friend, the contained Enum is
also Friend only, not public. A member can not be "more public" than the
containing class. Use "Public Module mdlDeclarations ".
--
Armin

Nov 20 '05 #3

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

Similar topics

3
2207
by: Laax | last post by:
Hi, I am trying to compile a .cc file and get the following error. I have translated the error message from original japanese text. So, it may not look exactly like standard(English) error message. Errors: 1. Warning (an old function) : specific "class" is necessary by friend designation toward the class. 2. Found & where , is expected.
8
5483
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
4
34779
by: eelis.net | last post by:
Hi I tried to convert the following C# code to vb.net. code in C# ________________________________________________________________ using System; using System.Reflection; using System.Resources;
6
38076
by: baret bonden | last post by:
I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem Dim curItem As String curItem = ListBox1.SelectedItem TextBox1.Text = curItem vcar = curItem
6
1771
by: Peter Oliphant | last post by:
I just discovered that the ImageList class can't be inherited. Why? What could go wrong? I can invision a case where someone would like to add, say, an ID field to an ImageList, possible so that the individual elements in an array of ImageList's could be identified by the ID, thereby allowing re-ordering the array without harm. A person could identify by index into the array, but that would not be preserved by re-ordering (and re-ordering...
9
1171
by: M. Posseth | last post by:
i have 3 forms Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As New Form2 frm.Show(Me) End Sub Private _test As String Friend Property test() As String
9
1659
by: Dimsion | last post by:
Hi, How do i expose all my forms and it controls to other form in the project? I want to be able to add a form and some control on it, this then be available to all other forms. form1 click event: 'this allow me to change the textbox on form2 from form1 Form2.text="" 'this allow me to add item to form2 from form1
6
1731
by: ralphmerridew | last post by:
My current project involves reading a particular data format. It would be convenient to be able to do something like: class DataClass { friend bool FileRunner::read_data (const vector<string>&); ... }; class OtherDataClass {
4
2100
by: Gotch | last post by:
Hi, I'm getting a very strange behaviour while running a project I've done.... Let's expose it: I've two projects. Both of them use a Form to do some Gui stuff. Other threads pack up messages this way like: public class UiMsg { public enum MsgType { StatusOk }; public MsgType Type;
0
9643
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10315
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6737
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
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
3
2877
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.