[AccessD] ParamArray problem

bruce_bruen at mlc.com.au bruce_bruen at mlc.com.au
Wed Mar 10 23:39:31 CST 2004





>"for each next" to iterate the array and found something
in an "empty" array."

Now that does sound strange.

The VB help for .NET certainly says that FOREACH should not execute on a
paramarray with .length=0
However, prior to .NET all paramarrays were passed as byrefs (hence my
comment on them being heap pointers)  in .NET they are always byvals.

Looks like there may be a situation in the VBA where the pointer is
initialised to a "random" heap pointer
under some circumstances - that would be bloody great hole!

have fun
B


                                                                                                                                         
                      "John W. Colby"                                                                                                    
                      <jwcolby at colbyconsulting.        To:       "Access Developers discussion and problem solving"                      
                      com>                              <accessd at databaseadvisors.com>                                                   
                      Sent by:                         cc:                                                                               
                      accessd-bounces at databasea        Subject:  RE: [AccessD] ParamArray problem                                        
                      dvisors.com                                                                                                        
                                                                                                                                         
                                                                                                                                         
                      11/03/2004 16:17                                                                                                   
                      Please respond to Access                                                                                           
                      Developers discussion and                                                                                          
                      problem solving                                                                                                    
                                                                                                                                         
                                                                                                                                         




>I also seem to remember that passing objects in paramarrays is a nono you
can only pass value items (???)

Help says objects can be passed, or at least the array can be declared as
type object.

And I was using a "for each next" to iterate the array and found something
in an "empty" array.

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of
bruce_bruen at mlc.com.au
Sent: Wednesday, March 10, 2004 11:58 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] ParamArray problem






John,

What you've written it looks right, bu I must ask how do you know there is
"something" in the ParamArray?  I would not expect it to be equal to a
null, it is (I can remember which) actually a stack or heap pointer.  I
also seem to remember that passing objects in paramarrays is a nono you can
only pass value items (???) , but its been months since I've VBA'd so to
speak so I could be wrong on that.


...meanwhile back to the C#

hth
Bruce



                      "John W. Colby"
                      <jwcolby at colbyconsulting.        To:       "AccessD"
<AccessD at databaseadvisors.com>
                      com>                             cc:
                      Sent by:                         Subject:  [AccessD]
ParamArray problem
                      accessd-bounces at databasea
                      dvisors.com


                      11/03/2004 15:43
                      Please respond to Access
                      Developers discussion and
                      problem solving






I am doing an init() method of a class that looks like:

Public Sub Init(ByRef robjParent As Object, ParamArray lDepObjsArr() As
Variant)

where robjParent = a pointer to the parent class (ME)

and ParamArray lDepObjsArr() As Variant MAY BE an array of dependent object
classes but specifically at the moment isn't being passed anything.  I.e.
the calling function looks like

MyClass.Init me

I am passing in a pointer to self in the first parameter and nothing at all
for the array.

Since it is an array that can contain variable number of objects I expected
it to allow this.  However when I get inside the init() the lDepObjsArr has
something in it.  That something is NOT a class, and I can't debug.print
the
value...

What the heck is going on here?  Can I not do this (not pass anything to a
paramarray?

John W. Colby
www.ColbyConsulting.com


--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com






More information about the AccessD mailing list