Passing array within array Holder class

I’m fighting an array passing issue this morning. Normally I pass a holder class full of arrays but thought I should be able to send an individual DATE array in the holder class. “this item does not exist” error occurs.

In the array holder class is Date array: Away_Return_Array(1)

I am sending this to a constructor in another window called: AwayDateWindow

In the receiving window is a constructor with a parameter: AwayReturnArray() as date
Code in constructor: Pointer_To_Away_Return_Array = AwayReturnArray()

The calling method: dim w as new AwayDateWindow (ArrayHolderClass.Away_Return_Array()) which does not work and returns: “this item does not exist”

and this Pointer_To_Away_Return_Array = AwayReturnArray ?

 dim w as new AwayDateWindow (ArrayHolderClass.Away_Return_Array)

[quote=495095:@Markus Rauch]and this Pointer_To_Away_Return_Array = AwayReturnArray ?

 dim w as new AwayDateWindow (ArrayHolderClass.Away_Return_Array)

i believe you only need () at parameter definition and return definition.
.Away_Return_Array must be a public property / computed property or method

[quote=495096:@Markus Rauch]i believe you only need () at parameter definition and return definition.
.Away_Return_Array must be a public property / computed property or method[/quote]

I tried again to remove the () off the ends of AwayReturnArray for both receiving and sending. Still an issue. The properties are public.

I do have a property in the receiving window; Pointer_To_Away_Return_Array(1) and its type is date. Still not working.

The call:

dim w as new AwayDateWindow (ArrayHolderClass.Away_Return_Array)  

The Constructor :

Sub AwayDateWindow (AwayReturnArray() as date) Pointer_To_Away_Return_Array = AwayReturnArray End Sub

[quote=495096:@Markus Rauch]i believe you only need () at parameter definition and return definition.
.Away_Return_Array must be a public property / computed property or method[/quote]

It appears the holder class the array need not be included. I’m not sure I understand why but this may have fixed it.

dim w as new AwayDateWindow (Away_Return_Array)

Does this make sense to you?
Also the () for Away_Return_Array() seems to be optional. Seems to work both ways.

this ArrayHolderClass.Away_Return_Array looks like a Shared Method or Shared Property
if “ArrayHolderClass” your class name?

just using this Away_Return_Array
looks like you have a Property inside a Class

with only fragments difficult to understand.

[quote=495122:@Markus Rauch]this ArrayHolderClass.Away_Return_Array looks like a Shared Method or Shared Property

this Away_Return_Array
looks like you have a Property inside a Class

with only fragments difficult to understand.[/quote]

So does that means a “Shared Method or Shared Property” in a class will not work in my case?
if I made it private would it work? It doesn’t seem to when I try it.

the question is
is Away_Return_Array a Shared Method or Shared Property ?
for me ArrayHolderClass looks like a class name and not a Property.
if this ArrayHolderClass is a class name then the name behind must be something shared.
you can use this single class instance without using the new word.

or was your intent this
Dim a As New ArrayHolderClass
Call MethodName(a.Away_Return_Array)

inside of the a instance of ArrayHolderClass it would look like
Call MethodName(Self.Away_Return_Array)
or
Call MethodName(Me.Away_Return_Array)
or
Call MethodName(Away_Return_Array)
or
dim w as new AwayDateWindow (Away_Return_Array)

[quote=495126:@Markus Rauch]the question is
is Away_Return_Array a Shared Method or Shared Property ?
for me ArrayHolderClass looks like a class name and not a Property.
if this ArrayHolderClass is a class name then the name behind must be something shared.
you can use this single class instance without using the new word.

or was your intent this
Dim a As New ArrayHolderClass
Call MethodName(a.Away_Return_Array)

inside of the a instance of ArrayHolderClass it would look like
Call MethodName(Self.Away_Return_Array)
or
Call MethodName(Me.Away_Return_Array)
or
Call MethodName(Away_Return_Array)
or
dim w as new AwayDateWindow (Away_Return_Array)[/quote]
Okay this is a little confusing so let me answer one at a time.

The array holder class was a class name with no supper.

and what was the definition/origin of Away_Return_Array?

It is a property in the ArrayHolderClass : Away_Return_Array(1) and it’s type was date

As you mentioned this was my intent.
Dim a As New ArrayHolderClass
Call MethodName(a.Away_Return_Array)

And it does work.

So how then is the array Away_Return_Array sent without a new statement?

then the usage with ArrayHolderClass. looks wrong.

So this would be correct ?
dim w as new AwayDateWindow (Away_Return_Array)

I guess I do need new AwayDateWindow to fire constuctor anyway.

[quote=495136:@Clifford Coulter]So this would be correct ?
dim w as new AwayDateWindow (Away_Return_Array)
I guess I do need new AwayDateWindow to fire constuctor anyway.[/quote]

i would not use this way with special constructors
it can be as property or computed property
dim w as new AwayDateWindow
w.Data= Me.Data
or as method
dim w as new AwayDateWindow
w.SetData(Me.Data)

with just one window
AwayDateWindow.Show
AwayDateWindow.SetData(Me.Data)

Somewhere you are loading the contents of a file into an instance of ArrayHolderClass, right? Where is that done in relationship to calling w as new AwayDateWindow(Away_Return_Array)? What is the name and scope of that instance?

In my Array Holder Class I have one method which loads from the HD many arrays and stores them as preference arrays. At one time I was using the class as a wrapper with methods (you worked with me) to manipulate the arrays. I believe the ArrayHolderClass grew from a misconception I had until recently that arrays could not be sent out to new class instances without being wrapped in a class. I got over that thought.

I do use this declaration when loading the arrays into the ArrayHolderClass.
Arrays = new ArrayHolderClass
Arrays.LoadDataArrays

dim w as new AwayDateWindow (Away_Return_Array) is public

I hope I answered what you were looking for.

[quote=495138:@Markus Rauch]i would not use this way with special constructors
it can be as property or computed property
dim w as new AwayDateWindow
w.Data= Me.Data
or as method
dim w as new AwayDateWindow
w.SetData(Me.Data)

with just one window
AwayDateWindow.Show
AwayDateWindow.SetData(Me.Data)[/quote]

I believe I started using a constructor because I was cloning the arrays in the constructor and using the clone to set slider control values when the window opened. By using a constructor they were always available when the window opened. If not the slider controls would be set to unwanted values and fed back to the clone array that was used to store temporary data. The clone is eventually cloned back to the original and stored to the HD as prefs.

Do you think your ideas would still work?

I will mention the cloning idea seems to work well since I’m manipulating a lot of data in a 5-dimensional array. When I wish to send it back to the original I do a clone compare to see if changes have actually been made before cancelling or saving.

[quote=495148:@Clifford Coulter]I do use this declaration when loading the arrays into the ArrayHolderClass.
Arrays = new ArrayHolderClass
Arrays.LoadDataArrays

dim w as new AwayDateWindow (Away_Return_Array) is public[/quote]
OK, some things to be aware of. Check the scope of Away_Return_Array here. It may or may not be the data you expect. The thing you should be passing is

dim w as new AwayDateWindow (Arrays.Away_Return_Array)

That is the values that Arrays.LoadDataArrays actually loaded. It is unclear what the unqualified property Away_Return_Array actually refers to.

[quote=495153:@Tim Hare]OK, some things to be aware of. Check the scope of Away_Return_Array here. It may or may not be the data you expect. The thing you should be passing is

dim w as new AwayDateWindow (Arrays.Away_Return_Array)

That is the values that Arrays.LoadDataArrays actually loaded. It is unclear what the unqualified property Away_Return_Array actually refers to.[/quote]

I think I owe you a beer next time I get to Portland for one of our Argentine Tango visits. (except who know when that will be with tango in the dumps with COVID). Anyway, you are right we know (Arrays.Away_Return_Array) is the correct ref since it was loaded in with Arrays. And it solved the issue of not getting the correct saved data out to the called window.

I was missing that fact. You’re good.