Home All Groups Group Topic Archive Search About
Author
8 Mar 2009 9:28 PM
Bee
Using VB6 with SP
If I use Friend instead of Public, what does it do for me for:
(1) classes etc within a project
(2) ActiveX.dll
(3) ActiveX.exe
I am confused.
I think I understand that it impacts visibility, but when and where?

Author
8 Mar 2009 11:08 PM
MikeD
"Bee" <B**@discussions.microsoft.com> wrote in message
news:2D0879D9-EC11-4E00-BE88-EC4E27B971B0@microsoft.com...
> Using VB6 with SP
> If I use Friend instead of Public, what does it do for me for:
> (1) classes etc within a project
> (2) ActiveX.dll
> (3) ActiveX.exe
> I am confused.
> I think I understand that it impacts visibility, but when and where?


Friend means the property/method's scope is that of the *project*.  It is
NOT made public to consumers of your ActiveX component.  IOW, other modules
of that ActiveX project (which have a reference to your class) see the
property or method.  But, it is not public, so OTHER applications using your
DLL or OCX don't see it.

--
Mike
Author
8 Mar 2009 11:50 PM
mayayana
> Using VB6 with SP
> If I use Friend instead of Public, what does it do for me for:
> (1) classes etc within a project
> (2) ActiveX.dll
> (3) ActiveX.exe
> I am confused.
> I think I understand that it impacts visibility, but when and where?
>
  It's visible within the project. Not usually
meaningful in an EXE, but in COM objects
it allows you to have a function that's visible
within the project without being visible in
the public interface.
Author
9 Mar 2009 12:15 AM
Ivar
"Bee" <B**@discussions.microsoft.com> wrote in message
news:2D0879D9-EC11-4E00-BE88-EC4E27B971B0@microsoft.com...
> Using VB6 with SP
> If I use Friend instead of Public, what does it do for me for:
> (1) classes etc within a project
> (2) ActiveX.dll
> (3) ActiveX.exe
> I am confused.
> I think I understand that it impacts visibility, but when and where?

One more:
If, in the IDE, Project1 is a standard exe, project2 is a user control, and
the user control has a referance to a class, any properties or mehods
declaired as friend in the class will be available to the usercontrol but
not the exe form that has a usercontrol on it. This means the usercontrol
has access to friend proceedures but the form in Project1 with a usercontrol
on it does not. Always handy to have friends in class :-)

Ivar
Author
9 Mar 2009 12:24 AM
Bee
Got it.  Thanks

Show quoteHide quote
"Bee" wrote:

> Using VB6 with SP
> If I use Friend instead of Public, what does it do for me for:
> (1) classes etc within a project
> (2) ActiveX.dll
> (3) ActiveX.exe
> I am confused.
> I think I understand that it impacts visibility, but when and where?
>