By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,587 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,587 IT Pros & Developers. It's quick & easy.

Scope error: "public" member not found in "friend" class/sub

P: n/a
I have encountered a situation that I don't understand. When I call a sub of
Friend scope (in an object with Friend scope), I am getting an error "Public
member 'subname' not found in type 'myType'". Any idea why? Since Friend
scope should be visible within my assembly, and everying is taking place
within a single project, I don't understand why this error is occuring.

Here is some illustrative code, where I would get the error in the
"MyA.MySub" line in class B:

Friend Class A
Friend Sub MySub()
....do some stuff
End sub
End class

Friend Class B
Friend Sub AnotherSub()
Dim myA as New A
myA.MySub()
End Sub
End Class

--- end code sample

If I change the scope of MySub from Friend to Public, the error goes away,
but it doesn't make sense to me to have a Public sub in a Friend class. I
would like to understand why I am getting the error in the first place.

Thanks in advance!

Tim
Dec 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"timbobd" <ti*****@discussions.microsoft.com> schrieb:
I have encountered a situation that I don't understand. When I call a sub
of
Friend scope (in an object with Friend scope), I am getting an error
"Public
member 'subname' not found in type 'myType'". Any idea why? Since Friend
scope should be visible within my assembly, and everying is taking place
within a single project, I don't understand why this error is occuring.

Here is some illustrative code, where I would get the error in the
"MyA.MySub" line in class B:

Friend Class A
Friend Sub MySub()
....do some stuff
End sub
End class

Friend Class B
Friend Sub AnotherSub()
Dim myA as New A
myA.MySub()
End Sub
End Class

--- end code sample

If I change the scope of MySub from Friend to Public, the error goes away,
but it doesn't make sense to me to have a Public sub in a Friend class. I
would like to understand why I am getting the error in the first place.


The snippet you posted compiles in VS.NET 2003 and VS 2005.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.