-
Sep 10th, 2024, 04:41 PM
#1
Thread Starter
Addicted Member
[RESOLVED] I need array help
I know I am going to have a hard time explaining.
What I need is:
Array of sDay()
containing an array of sJob()
containing an array of sSequence()
with array of sSequence()
containing a lStart and lFinish.
sDay .LBound = 0, sDay UBound = 7 ' FIXED Array Size
sJob LBound = 1 , sJob UBound = 8 ' FIXED Array Size
sSequence LBound = 1, sSequnce UBound is ReDimable
Then how to loop on all and get sSequence lStart and lFinish ?
I tried a Type but my head started buzzing so I gave up.
-
Sep 10th, 2024, 04:48 PM
#2
Thread Starter
Addicted Member
Re: I need array help
OMG, my brain fog is clearing.
Will this work ?
Private Type tSchStartStopType
lStartTime As Long
lStopTime As Long
End Type
Private Type tSchSequenceType
atSequence() As tSchStartStopType
End Type
Private Type tSchJobType
atJob(1 To 8) As tSchSequenceType
End Type
Private m_atDay(0 To 7) As tSchJobType
-
Sep 10th, 2024, 04:53 PM
#3
Re: I need array help
I'm not at all clear on what you want, but it sounds like UDTs might be the answer for you. UDTs give you an easy way to have nested arrays (nested to any level you want).
Multi-dimension arrays is another option, but, the way you describe things, I'm not sure that'll do it for you.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Sep 10th, 2024, 04:57 PM
#4
Re: I need array help
Something like this?
Code:
Private Type tSequence
lStart As Long
lFinish As Long
End Type
Dim arr() As tSequence
Private Sub Form_Load()
Dim i As Long, j As Long, k As Long
ReDim arr(0 To 7, 1 To 8, 0 To 0) As tSequence
For i = LBound(arr, 1) To UBound(arr, 1)
For j = LBound(arr, 2) To UBound(arr, 2)
For k = LBound(arr, 3) To UBound(arr, 3)
' assign values or whatever
Debug.Print arr(i, j, k).lStart, arr(i, j, k).lFinish
Next k
Next j
Next i
ReDim Preserve arr(0 To 7, 1 To 8, 0 To 1) As tSequence
' etc
End Sub
-
Sep 10th, 2024, 05:00 PM
#5
Re: I need array help
Or, a combination of a UDT and a multi-dimension array.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Sep 12th, 2024, 01:10 PM
#6
Thread Starter
Addicted Member
Re: I need array help
VanGoghGaming
Thanks.
I will try to incorporate that code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|