Passing dynamic array of custom type to form method from another form 
Author Message
 Passing dynamic array of custom type to form method from another form

hi,

i defined a public custom type in a module like this:

  public type mytype
    a as integer
    b as string
  end type

and a public form method to be called from another form like this:

  public sub mymethod(a() as mytype)
  end sub

the compiler does not like this situation and issues an 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"

i understand the importance of this error as of encapsulation but i
don't get why this code generates this error. as the type is public,
then the module is not public i suppose... how do i get my module to be
public or what else is the problem? thanks.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Passing dynamic array of custom type to form method from another form

this is an area im just getting into, so i may be wrong......

I think what its asking for is for you to define the type as public in a
class module

--


Quote:
> hi,

> i defined a public custom type in a module like this:

>   public type mytype
>     a as integer
>     b as string
>   end type

> and a public form method to be called from another form like this:

>   public sub mymethod(a() as mytype)
>   end sub

> the compiler does not like this situation and issues an 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"

> i understand the importance of this error as of encapsulation but i
> don't get why this code generates this error. as the type is public,
> then the module is not public i suppose... how do i get my module to be
> public or what else is the problem? thanks.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Passing dynamic array of custom type to form method from another form
and with that i get:

"cannot define a public user-defined type within a private object
module".

do you know how i get the object module to be public? that will destroy
encapsulation i suppose, but that is perfectly ok for me.



Quote:

> this is an area im just getting into, so i may be wrong......

> I think what its asking for is for you to define the type as public
in a
> class module

> --



> > hi,

> > i defined a public custom type in a module like this:

> >   public type mytype
> >     a as integer
> >     b as string
> >   end type

> > and a public form method to be called from another form like this:

> >   public sub mymethod(a() as mytype)
> >   end sub

> > the compiler does not like this situation and issues an 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"

> > i understand the importance of this error as of encapsulation but i
> > don't get why this code generates this error. as the type is public,
> > then the module is not public i suppose... how do i get my module
to be
> > public or what else is the problem? thanks.

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing Dynamic Arrays from a class into a form procedure

2. how to get custom form and send custom form from VB

3. how to load custom usercontrol dynamic on form

4. custom form control: Cannot view design view of forms that inherit this form

5. Passing info from dynamic form to caller

6. Forms Collection: Using it to Open Forms by Passing the Form Name as a String Variable

7. passing focus info form form to form

8. VB3: Dynamic Arrays and MDI Child Form Communication Problem

9. Adding to Dynamic Arrays through Forms

10. Run time Control Array and Dynamic Form Generation

11. A better way for dynamic form sizing based upon control array

12. Arrayed Forms with Dynamic Subs

 

 
Powered by phpBB® Forum Software