In a MODULE (.bas), I created this UDT as:
Public Type DATA_ARRAY
dDate As Date
Open As Single
High As Single
Low As Single
Close As Single
Vol As Long
OI As Long
End Type
In the General Declarations of cPanels (CLASS MODULE), I defined:
Private m_DataArray() As DATA_ARRAY
And in cPanels included:
Property Let AssignData(DataArray() As DATA_ARRAY)
m_DataArray = DataArray
End Property
Compile Error:
Only public user defined types defined in public object modules can be
used as parameters or return types for public procedures of class
modules or as fields of public user defined types.
"Only public user defined types..." : Well, my UDT is public.
"...defined in public object modules..." :
I'm not sure if a .bas MODULE is considered an 'object' module, but I
also tried to put my UDT in the cPanels class as well and that didn't
work either. So I'm not sure what the problem is here.
But since "class modules" is mentioned also in this error message, I
have to assume it is not the same as "object modules", and the other
other modules I see here other than "class modules" via the IDE are
these .bas Modules.
So this error does not make sense to me.
Help?
Webbiz
I put "Friend" in front of "Property Let" and it compiled okay.
So many stipulations. ;-b
Webbiz
On Sat, 05 Sep 2009 23:59:13 -0500, Webbiz <nos...@forme.thanks.com>
wrote:
Another 'work-around' is to define and use a Type Library.
Here is a great tutorial for using typelibs:
http://www.devx.com/vb2themax/Article/19830/1763/page/1
If you are not using Pro/Ent editions you can get a TypeLib compiler as part
of McKinney's WinAPI typelib download. This package is useful as you can use
and abuse his IDLs as 'seeds' and examples for creating your own.
http://vb.mvps.org/hardcore/html/sourcecode.htm
(download the WinTlbU.zip)
-ralph
This isn't the same as simply using the "Public" keyword in your program...
though things decorated that way do get published when you create something
that can be registered (ActiveX EXE, DLL, OCX).
Think of it as "public" in a broader sense: not just within your program but
within the whole computer.
"Webbiz" <nos...@forme.thanks.com> wrote in message
news:eqf6a59gttcko5a4a...@4ax.com...
> "Only public user defined types..." : Well, my UDT is public.
>
> "...defined in public object modules..." :
>
> I'm not sure if a .bas MODULE is considered an 'object' module, but I
> also tried to put my UDT in the cPanels class as well and that didn't
> work either. So I'm not sure what the problem is here.
> Webbiz
- Private does not allow the method to be seen in other modules in the
project nor outside the project.
- Friend allows the method to be seen in all modules in the project, but not
outside the project.
- Public allows the method to be seen in all modules in the project and
outside the project(Except standard EXE).
Sometimes when you have a standard EXE project, the compiler objects to
using "Public" in certain situations(in class modules), so in these cases
use "Friend" instead.
Yes, I'm using Professional version.
:-)
Webbiz
On Sun, 6 Sep 2009 12:47:11 -0500, "Ralph" <nt_cons...@yahoo.com>
wrote:
You need to be a little clearer on the scenario you are describing. Friend
methods and properties are never part of a public interface and thus could
never be accessed in a late-bound component, with or without UDTs.
So what am I missing? <grin>
-ralph