« first day (1414 days earlier)      last day (1766 days later) » 
00:00 - 21:0021:00 - 00:00

12:01 AM
RELOAD!
[rubberduck-vba/Rubberduck] 8 commits. 1 opened issue. 37 issue comments. 940 additions. 360 deletions.
[Zomis/Server2] 1 commit. 2 additions. 3 deletions.
[Zomis/UltimateTTT] 6 commits. 2004 additions. 1866 deletions.
 
 
1 hour later…
1:02 AM
You're among the heroes that still work with #VB6? We've got something cooking for you... #ComingSoon https://github.com/rubberduck-vba/Rubberduck/pull/3935
 
1:43 AM
@TweetingDuck are these legacy programs? Iā€™m fully ignorant as to vb6
@M.Doerner what do you work on or with for your work?
 
 
2 hours later…
3:16 AM
0
Q: Fill in workbook with data from another workbook

rzenvaFollowup question: Fill a new Workbook with info from another workbook I made a macro that will fill in data in a workbook that has 65 (24 are user filled) columns and can go as long as 1500 rows. In an ideal scenario, the workbook has a perfect column that could work as a key to fill in the da...

 
 
1 hour later…
4:28 AM
#TIL Ctrl+K, Ctrl+D will indent the current file that's open in VS.
 
4:39 AM
@IvenBach VB6 is the last version of Visual Basic just before the .NET came in picture. VB6 and VBA are very similar, practically the same, except that you can create .exe with VB6; you can't do that w/ VBA.
 
Ah.
 
> Closes #3946

Turns out that unicode files *must* have the BOM to be recognized by InnoSetup as such as per the SO thread referenced in the issue. Updated all `.iss` files to use an explicit BOM and also updated the script for the autogenerated `.iss` file.
 
5:00 AM
[rubberduck-vba/Rubberduck] build for commit 4bfde8a8 on unknown branch: AppVeyor build succeeded
[rubberduck-vba/Rubberduck] build for commit 4bfde8a8 on unknown branch: 57.64% (target 0%)
 
5:19 AM
Tried to sync with RD and now getting error regarding powershell.
The command "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "C:\Users\IvenBach\Source\Repos\Rubberduck\Rubberduck.Deployment\PreInnoSetupCon‌​figuration.ps1 -WorkingDir C:\Users\IvenBach\Source\Repos\Rubberduck\Rubberduck.Deployment\" exited with code 1. Rubberduck.Deployment
Brain isn't working... Sleep first then fix in the morning.
Night pond.
 
5:39 AM
> I'll leave a short summary from chat regarding this topic:
It appears the current domain host (GoDaddy) does not support LetsEncrypt and likely won't in the future. The current contract with GoDaddy expires early 2019. @retailcoder 's plan is to not renew the contract and then transfer the domain to a different host (Azure?) that seems to be better in about all aspects. Once the new host is in place, it should be trivial to then set up LetsEncrypt / https.
 
6:56 AM
@IvenBach I am working with Access and Excel. The things I program in Access are rather simple databases interfacing with our oracle and sql server databases, doing data transformation and some checks. In Excel I help to maintain/build tools to facilitate our regulatory reporting and statistical analysis of insurance reserves.
However, the programming is not my main job.
Doing the statistical analysis and preparing the corresponding parts of the regulatory reporting is.
 
yay! finally have cleaned my registry manually of any stale Rubberduck settings...
Have attempted to install Rubber stable version 2.2 but...
the installer doesn't work at ALL.. :(
mind you I recently had my PC refreshed to Win 10.0.1733 Build 17133. no installation dialog and also had double checked my registry. Nothing...
Not all is lost though... Have refreshed by development build and doing a small test...
stay tuned.
 
@PeterMTaylor Rubberduck does not have any settings in Registry...
 
okay..@Vogel612
 
I'd assume a broader meaning, including the entries for RD's classes
 
7:18 AM
I guess he meant the COM registration maybe ?
 
possibly folks..for now I'm getting my local copy of RD next working according to the wiki build instructions...
fun...420 errors to sort out...
7> All packages listed in C:\Users\Peter\Source\Repos\Rubberduck\RubberduckTests\packages.config are already installed.
7>CSC : error CS0006: Metadata file 'C:\Users\Peter\Source\Repos\Rubberduck\Rubberduck.Core\bin\Debug\Rubberduck.Core.dll' could not be found
7>CSC : error CS0006: Metadata file 'C:\Users\Peter\Source\Repos\Rubberduck\Rubberduck.Main\bin\Debug\Rubberduck.dll' could not be found
7>CSC : error CS0006: Metadata file 'C:\Users\Peter\Source\Repos\Rubberduck\Rubberduck.Inspections\bin\Debug\Rubberduck.Inspections.dll' could not be found
I'm sure I stuffed up my configuration somewhere...
[20/04/2018 5:11:01 PM Informational] ------ Run test started ------
[20/04/2018 5:11:09 PM Warning] Could not find file C:\Users\Peter\Source\Repos\Rubberduck\RubberduckTests\bin\Debug\RubberduckTests.dll.
[20/04/2018 5:11:09 PM Warning] None of the specified source(s) 'C:\Users\Peter\Source\Repos\Rubberduck\RubberduckTests\bin\Debug\RubberduckTests.dll' is valid. Fix the above errors/warnings and then try again.
hmm.. i have a look again later this weekend...dinner to prepare for the family. Keep up the good work.
 
8:08 AM
@FreeMan Hi, Wanted to pick your brains please. So I am using the selenium basic wrapper from FlorentB. I was then watching the following Selenium tutorial where the user references another wrapper and a method whereby code can be recorded in Firefox and transferred across into VBE....does this ring any bells as to how this might be achieved please?
 
 
1 hour later…
9:11 AM
 
9:41 AM
@PeterMTaylor So you never even see the language dialog at all? Sounds like it never ever ran. Have you tried right-clicking it and running it as administrator?
@PeterMTaylor That's typical when you can't build a dependent project. Those errors will be corrected when you fix whatever is preventing building in the project that's lower on the dependency chain. Look for other errors and resolve them first.
@PeterMTaylor Ever since we switched to NUnint, I've observed that when building, NUnit will hijack the Output tab. You should pay attention to whether the output console is et to Build, rather than to Tests and manually change to see what was the output from the build. Obviously, you must build before you can do anything meaningful with tests.
@PeterMTaylor One more thought --- Windows 8/10 is known to block unknown installers downloaded from internet. Normally, you get a dialog like this one below. But, I remember on few occasions, the dialog didn't appear right away and sometimes it appears behind other windows. It may have then timed out, which would be why nothing happened. Next time you try this, try and minimize everything (e.g. Show Desktop) and then restore the Windows Explorer window where you launched the installer.
 
 
2 hours later…
12:55 PM
[rubberduck-vba/Rubberduck] build for commit 4568b9db on unknown branch: AppVeyor build succeeded
[rubberduck-vba/Rubberduck] build for commit 4568b9db on unknown branch: 57.64% (target 0%)
 
@Duga lol, emojis taking over PR's!
 
[rubberduck-vba/Rubberduck] bclothier pushed commit a1ff4490 to next: Add BOMBs!!! OMG
[rubberduck-vba/Rubberduck] bclothier pushed commit 1cbf2f70 to next: Remove a spray English phrase in french translation.
[rubberduck-vba/Rubberduck] bclothier pushed commit 4bfde8a8 to next: Update encoding to use BOM and add lot of missing semi-colons.
[rubberduck-vba/Rubberduck] bclothier pushed commit 4568b9db to next: Add comments to explicitly remind of the required encoding for all iss files.
Merge pull request #3947 from bclothier/SetUpTheBomb

Fixes encoding issues with localized installer messages.
 
 
@Duga Do we need to take cover? o.O
 
1:52 PM
@QHarr Good day! I watched no tutorials. I did try using the recorder in Firefox, but I had zero idea of what to do with the output of it. I ended up loading the page in Chrome, using the dev tools to identify the element I was after and somewhat blindly guessing how to get there to click, fill in text, etc.
That was the hardest part - figuring out how to identify the element I was after. I've got a somewhat random mish-mosh of FindElementBy... usages in my code, each one seemed to require a slightly different approach from the last.
I could be that Selenium is a bear, that the sites I am accessing are not well written, or (most likely) that I have 0 clue about web design and didn't understand what I was looking at.
 
2:24 PM
@MathieuGuindon Once I get the powershell issue with the RD.Development project fixed I'll be working on it.
@this What's requirement to get PS to run the file for setup? I tried searching and looked through the last month of transcript but didn't see the last time you helped m.
something something Self-sign mumble?
 
particularly the part about setting the execution policy?
 
2:49 PM
I don't know how I passed school... #ReadingFail
 
so u ok now?
 
I think so. Will attempt to fix after I get back home.
 
@FreeMan No worries. Thank you for responding. I spent the day having a look at some material. Whilst I am still not sure how to go about it with the latest FireFox which has integrated much into the dev tools (e.g. no more firebug) I have a fair idea now how to leverage with selenium basic. So, more trial and error to come and I will get there slowly :-)
 
3:36 PM
ugh, per-user install still not working in Sage300 for God knows why
 
@this > Visual Basic is forced to use the Windows API to execute virtually all of its string operations (implicitly through Visual Basic's intrinsic functions). This forces Visual Basic to internally use the C++ style strings all the time while providing the programmer with its own easier-to-use string data type.
From the article you dug up for me: jasinskionline.com/windowsapi/articles/intro/part06.html.
Behind the VBA facade you're using C++.
 
@IvenBach Iven, Iven, what have I told you about abstractins? We're all living in a world of lies. ;)
2
@MathieuGuindon but it works in Excel, right?
 
@IvenBach And behind the C# facade, you are using what?
 
Just a second. I think i found the light switch. 15 mins to test.
 
@this it does
 
3:41 PM
Bytecode (.NET Native), MSIL (.NET Framework), and something else for .NET Core, IIRC.
 
except on that particular VM I'm desperately missing my ducky there :)
 
@Hosch250 At the end of the day, it's all ones and zeroes.
@MathieuGuindon so annoy your co worker then. :)
i can only assume that Sage decided to assume that anything COM would be exclusively in HKLM and won't much as look at HKCR or HKCU.
 
@this Yep. At the very bottom of the rabbit hole.
 
Wait, remind me please --- Sage does see RD as an add-in but then it complains the DLL is missing, right?
 
"Repair VBE AddIn registration" should really be "Register VBE add-in" or something that doesn't imply something is broken
@this yes
 
3:45 PM
@Hosch250 and it's few miles deep, to boot. Who know what else abstractions they've stuck in between all those layers. we're miles away from the hardware, even.
 
also, confirming - admin install does work :)
won't annoy anyone, unless they go and register RD for themselves
 
I suppose I can reword it. I almost went with "Register or Repair" but that was too wordy
good - earlier you couldn't because someone else was using the VM, too, IIRC.
 
I don't RC
ugh
okay wtf
 
I hope you're not wtf'ing at my poor choice of naming. :)
 
I need to expose a ProductionInfo[] through COM, and VBA isn't seeing it as an array, vm.Quantities(i) isn't compiling
object[] IMainViewModel.Quantities
{
    [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT]
    get { return SizedQuantities.ColorProductionInfo.SelectMany(info => info.SizeInfo).ToArray(); }
}
any ideas?
 
3:49 PM
Sub Test()
Dim originalString As String
originalString = "Default value"

Dim originalRange As Range
Set originalRange = Sheet1.Range("L15")
ModifyByVal originalString, originalRange
End Sub

Private Sub ModifyByVal(ByVal stringToAlter As String, ByVal someRange As Range)
stringToAlter = "String been edited"

someRange.Value2 = "Range has been edited"
End Sub
 
@MathieuGuindon what does the VBA OB say about that method?
 
How if you pass a range ByVal yet you can still edit the members of it. That's kinda-sorta what the C++ pointer reference does for strings coming from VBA.
 
@this Property Quantities As Variant() read-only; Member of CutMakeTrim.CmtViewModel
 
@IvenBach pretty much -- the ByVal is applying to the pointer
 
@Hosch250 Fat hamsters on running wheels to power the computer.
 
3:52 PM
@MathieuGuindon just checking - do you really wanna variants? You're returning object[]
 
I'd love it to be ProductionInfo[], but that didn't work either, so I'm just trying stuff
 
the next thing to check would be ?IsArray(vm.Quantities)
 
well I can get the LBound and UBound values for it
 
now, the array marshaling is ...... sketchy.
 
no shit
 
3:53 PM
I found that the hard way when I was fiddling w/ SSRS
what i ended up was implementing a collection and exposing them to VBA
 
I think I might need to ^^
that
 
@this You can set somerange = somerange.offset(1,1) in the method that it's passed to ByVal yet when that method returns to the caller your original VarPtr will be the same as before you passed it.
 
i think that would be much more cleaner anyway. Arrays for objects are .... meh.
 
make a ProductionInfos collection type that extends Enumerable
right?
 
and if you want to do For Each, you can use ArrayList
(must be non-generic, tho)
 
3:54 PM
hmm
that could be nice
 
but yeah, you can implement IEnumerable, which ArrayList does anyway, but if you use ArrayList it's more VBA-friendly.
 
wait ArrayList isn't sealed?
 
IDK
haven't really bothered deriving it. I just expose a property on the class
 
oh great, "Sage 300 ERP VBA has stopped working"
^ on exit
 
it's missing a D
should be "DERP"
 
3:55 PM
lol
#FunFact: I got the message twice
and when it failed loading earlier, I got the failure message twice
I wonder if these idiots are loading VBE addins twice
 
Sub Test()
    Dim originalString As String
    originalString = "Default value"

    Dim originalRange As Range
    Set originalRange = Sheet1.Range("L15")
    Debug.Print "originalRange's pointer pre-call: " & VarPtr(originalRange)
    ModifyByVal originalString, originalRange
    Debug.Print "originalRange's pointer post-call: " & VarPtr(originalRange)
End Sub

Private Sub ModifyByVal(ByVal stringToAlter As String, ByVal someRange As Range)
    stringToAlter = "String been edited"

    someRange.Value2 = "Range has been edited"
originalRange's pointer pre-call: 1634284
 1634076
 1634076
originalRange's pointer post-call: 1634284
ByRef someRange as Range gives me
originalRange's pointer pre-call: 1634284
 1634284
 1634284
originalRange's pointer post-call: 1634284
 
confirmed: ArrayList isn't sealed
 
C# you mean?
 
well ... why would it be?
 
3:58 PM
@this I'm using another lightbulb now!
 
@Vogel612 now that you're asking, ...
@this #ScrewIt: exposing it as an ArrayList seems to work
well, at least it compiles
 
@puzzlepiece87 @FreeMan I hope my explanation above can help you grok what took me a couple days to figure out.
 
woot! works!
 
4:13 PM
@MathieuGuindon :+1:
@IvenBach :+1:
RE: array - i think it's best to avoid it altogether for COM interop. Besides implementing com-visible collection classes isn't that bad and aids in discoverability VBA-side.
the less MarshalAs you do, the better.
hmm #TIL: public bool? Accepted { get; set; } = true;
feels funky....
 
4:35 PM
@this codeguru.com/vb/gen/vb_misc/algorithms/article.php/c7495/… has me struggling on the part about Exponents Offset
 
@IvenBach Thanks.
 
@IvenBach so this part is specific to floating data type --- Single or Double
see, what they do is they divide the number into the mantissa and the exponent and also the sign.
 
1.625 is stored as 101E0. That equates to 1 + 1/2 + 0/4 + 1/8 = 1.625.
That part I got. It's the exponent Positive and negative exponents.
 
Divided in half for the signed bit on the exponent. Parallel found in VBA Long &H7FFF vs &H8000.
 
4:44 PM
@QHarr Trial & error was my approach, too. Let me know if you hit issues. No promises, but I'm happy to help where I can.
 
5:00 PM
@this Again I'm kinda-sorta getting it but need more time to let what I've already understood sink in. Working on the string part.
 
@FreeMan That's kind. Thanks. Kinda happy to have a new "toy" at present to play with. See how long that lasts.
 
5:15 PM
Now I understand how VarType() works.
 
5:27 PM
How do you view the size of a variable?
 
LenB() it.
 
What about for arrays?
Sub oenuthoeuntheo()
    Dim temp(1 To 4, 1 To 3) As Integer

    Debug.Print LenB(temp)
End Sub
It's not liking the above. LenB(temp(1,1)) is fine.
 
you can't size array that way - you'll have to basically LenB(<an element of the array>) * ((UBound(<array>) - LBound(<array>)) + 1)
oh, that won't do for the >2d array.
>2d, #YouAreScrewed
I don't think there's a programmatic way to count the # of dimensions, is there?
 
Isn't the array actually larger than that?
It has all kinds of housekeeping fields.
 
codeguru.com/vb/gen/vb_misc/algorithms/article.php/c7495/… part about arrays is what I'm working on understanding. It says Dim arr_intTemp(4)(3) As Integer should be 60 bytes.
Was hoping to see that number pop up with LenB. #WishfulThinking
 
5:36 PM
That's true, Max. The above would only give you the raw size of the array data itself
@IvenBach for >2d, you can adapt this solution: stackoverflow.com/questions/6901991/…
you'll have to manually calculate in the size of the structs to get the true size of the array. That includes SAFEARRAY and SAFEARRAYBOUNDS. I don't know if you might have mulitple structures, so you might need to check for that, as well.
skimming, it looks like you get one SAFEARRAYBOUND per dimension.
 
@this The linked source really provides the entire layout for a multidimansional array.
 
5:53 PM
maybe it'd be a good idea if I actually read the article? :)
 
6:09 PM
Sub Test()
    Dim temp(4, 3) As Integer
    Debug.Print MemorySizeOfArrayInBytes(temp)
End Sub

Public Function MemorySizeOfArrayInBytes(ByVal temp As Variant) As Long
    Dim maxDimension As Long
    maxDimension = GetArrayDimensions(temp)

    Dim totalElements As Long
    totalElements = 1
    Dim i As Long
    For i = 1 To maxDimension
        totalElements = totalElements * UBound(temp, i)
    Next

    Dim elementBytes As Long
    elementBytes = totalElements * LenB(temp(0, 0))

    Const SAFE_ARRAY As Long = 20
Gives me 60 for the Integer but changing temp to be of type Long it's still 60. I'd expect it to be 120 since 4 bytes is used to store a Long value.
Working with stuff I don't fully understand.
 
I would have expected 84.
 
Why 84? I see why 84 now.
 
You only double the size of the data area.
 
I speak without thinking all too often.
20 + 8 * 2 + 48 = 84.
 
Exactly
 
6:15 PM
SafeArray + (SizePerDimension * MaxDimension) + (TotalElements * ElementByteStorage)
 
Where SizePerDimension is always 8 = SizeOfLength + SizeOfLBound
 
@M.Doerner This is the part where I'm unable to understand myself where the 8 bytes comes from.
Is it because of the SafeArrayBound structure?
 
The last section of the array base is itself an (unsafe) array storing tuples (size of dimension, lower bound of dimension) for all dimensions. Both numbers are of type Long and thus require 4 bytes each.
Yes
 
msdn.microsoft.com/en-us/library/windows/desktop/… with ULONG cElements and LONG lLbound?
 
Well, that makes sense.
Still, a ULONG also takes 4 bytes.
 
6:30 PM
That was my assumption but I don't understand what the structure actually is, or what it's doing.
a long is a long. Whether it's signed or not it still takes 4 bytes.
 
A negative array length would not make to much sense.
The structure does pretty much what its name suggets, it stores the bounds of an array dimension.
 
Is this what allows RTE-9 for Dim temp(4, 3) as long when I try to do Debug.Print temp(10, 10)?
Well not allow but gives the warning instead of BSOD.
 
Yes, basically.
Mind that in C++, it might not be always a BSOD.
 
You safe how long the array dimesion is, which is important to know where to look for elements in the data area, and the offset you have to apply when resolving the indices passed in.
 
It might be simply corrupted memory.
IN a way, corrupted memory is worse because nothing will seem wrong immediately.
Until you actually need some data from that memory region that was corrupted by the buffer overflow, then.... ????
maybe you get funny results. Maybe you get extra lives. Maybe you get BSOD. Who's to know.
 
6:41 PM
@M.Doerner Where it starts and how many are offset to make sure you're getting the correct result. :+1:
I'm just a bit slow when it comes to internalizing the meaning of everything.
 
@IvenBach Note that you also need the length of all but the last dimension to actually find the correct value in the data area.
 
Do you mean element instead of dimension? The last dimension comes first in the array.
> The array rgsabound is stored with the left-most dimension in rgsabound[0] and the right-most dimension in rgsabound[cDims - 1].
 
7:03 PM
Let's say you have an array arr(1 To 4, 2 To 4, 3 To 4) As Byte, where in the data area would you look for arr(2,3,4)?
 
I as a human would look in the 2nd row 3rd column 4th compartment.
To the computer though that's nonsensical.
The first dimension of the array has 4 elements with a lowerbound of 1.
It knows you want the second element in dimension 1.
It offsets by 1 from the lowerbound to get the second element.
It does so for each dimension in the array.
 
Good, go on.
 
From here on out I've no clue what it's actually doing. Bear with my bumblings.
The storage memory of the computer doesn't have depth nor width, only length.
It can only go down the length of the memory addresses and put/pull information in them.
Reading and regurgitating tells me that the last dimension of the array is the first in the list
Dim arr_intTemp(0 to 1, 1 to 2) As Integer

arr_intTemp(0, 1) = 1
arr_intTemp(0, 2) = 2
arr_intTemp(1, 1) = 3
arr_intTemp(1, 2) = 4
Has the information stored as
1
3
2
4
Assuming this holds true for 3D arrays.
arr(1,2,3)=1
arr(1,2,4)=2
...
arr(4,4,3)=23
arr(4,4,4)=24
It'd be listed as follows
Wait a sec for me, just got really hard mentally.
arr(1,2,3) = 1
arr(1,2,4) = 2
arr(1,3,3) = 3
arr(1,3,4) = 4
arr(1,4,3) = 5
arr(1,4,4) = 6
arr(2,2,3) = 7
arr(2,2,4) = 8
arr(2,3,3) = 9
arr(2,3,4) = 10
arr(2,4,3) = 11
arr(2,4,4) = 12
arr(3,2,3) = 13
arr(3,2,4) = 14
arr(3,3,3) = 15
arr(3,3,4) = 16
arr(3,4,3) = 17
arr(3,4,4) = 18
arr(4,2,3) = 19
arr(4,2,4) = 20
arr(4,3,3) = 21
arr(4,3,4) = 22
arr(4,4,3) = 23
arr(4,4,4) = 24
List how humans understand ^
1 'arr(1,2,3)
7 'arr(2,2,3)
13 'arr(3,2,3)
19 'arr(4,2,3)
3 'arr(1,3,3)
9 'arr(2,3,3)
15 'arr(3,3,3)
21 'arr(4,3,3)
5 'arr(1,4,3)
11 'arr(2,4,3)
17 'arr(3,4,3)
23 'arr(4,4,3)
2 'arr(1,2,4)
8 'arr(2,2,4)
14 'arr(3,2,4)
20 'arr(4,2,4)
4 'arr(1,3,4)
10 'arr(2,3,4)
16 'arr(3,3,4)
22 'arr(4,3,4)
6 'arr(1,4,4)
12 'arr(2,4,4)
18 'arr(3,4,4)
24 'arr(4,4,4)
^ As computer has it stored, based on my reading.
@M.Doerner That's what I think is going on.
 
7:22 PM
Looking at that, what has the size of the dimensions to do with the resolution of indices?
 
Sub RedimTest()
    Dim foo() As Long
    ReDim Preserve foo(1 To 3, 2 To 5)
    ReDim Preserve foo(1 To 3, 2 To 4)
End Sub
Playing around earlier I came across failures but the above works.
ReDim Preserve foo(1 To 3, 2 To 5)
ReDim Preserve foo(1 To 3, 1 To 5)
^ Barfs
I can't figure out how to say what I'm thinking...
The lowerbound of the highest dimension can't be altered because it's the first in the list.
The upperbound of the highest dimension can be altered because it's the last in the list and it's only adding to or removing from the array.
 
Interesting, that should actually work.
Oh, I see.
 
Subscript out of range occurs on ReDim Preserve foo(1 To 3, 1 To 5)
I did notice.
Sub RedimTest()
    Dim foo() As Long
    ReDim Preserve foo(2, 2)
    ReDim Preserve foo(2, 1 To 4)
End Sub
^ Also breaks but
Sub RedimTest2()
    Dim foo() As Long
    ReDim Preserve foo(2, 2)
    ReDim Preserve foo(2, 0 To 4)
End Sub
^ Doesn't.
 
Think about where the element (1,1) would have to go in the data area.
 
Assuming option base isn't altered.
If you alter the lbound of the outermost dimension it'd cause the entire list to have to be shifted.
 
7:30 PM
What does preserve tell the compiler?
 
foo(1,1) would go in as the second entry for dimension 1 and dimension2.
preserve tells the compiler to keep whatever was there and not wipe it.
Sub RedimTest2()
    Dim foo() As Long
    ReDim Preserve foo(2, 2)
    ReDim foo(2, 1 To 4)
End Sub
Works since there is no instruction for preservation of data and it can all be wiped clean.
 
I was still talking about the initial example.
(2 To 5) to (1 To 5)
 
That I'm not sure.
 
Per how the data area is layed out, it has to go to position one.
What would you find there with preserve?
 
Since the lbound is stated and you're changing it the array would have to remap all the elements.
 
7:36 PM
Yes, thus, preserve is illegal in this case.
 
What would have been in element2 now would be in element1. I'm guessing this would have lead to too many headaches and that's the reason they disallowed it.
I'm starting to understand why the RTE9 subscript out of range message makes sense.
 
The lower bound is outside the data area applying preserve.
Increasing the UBound of the last dimension, though, will just require more memory right after the old data area.
 
That makes sense, now that I understand how the information is being stored.
 
Btw, even with preserve the data area will be copied if there is no sufficient amount of of free memory right after the array.
 
So all the information would get moved to a new address, but the pointer held in the variable names location isn't what gets updated, only the location it points to?
@M.Doerner Thank you very much for the extra help.
 
7:53 PM
You are welcome.
Just to give my own answer to my initial question, counting positions with base 0, the element is at position 17 = (2-1) + (3-2)*(4-1+1) + (4-3)*(4-1+1)*(4-2+1).
 
8:34 PM
@M.Doerner I'd forgotten about your original question. Working through how it's figured out.
 
Note that (4-1+1) = size of first dimension.
 
I don't follow your math.
I calculate the offset to be 10 from the first element, as it's stored in the computer.
 
Hm that is a bit strange, I just read up in the spec on how comparison between values of different value type works in VBA and had to realize that when you compare a Single and a Double, the Double will get converted into a Single.
I can find arr(2,3,4) at position 18 in your list, counting 1-based.
 
I was looking at arr(3,4,3) for some reason.
arr(2,3,4) = 17 offsets from the 1st element.
 
Yes
 
8:48 PM
From my math it looks like I'm doing the same but am not sure how to describe the offsetting it's doing.
 
The only thing you do not need from the safe array bound struct to compute that is the size of the last dimension.
Let's go through it step by step.
 
My best effort to put into words for the offset: Each dimension requires the summation of each prior dimensions product of cElements and lLbound.
 
The lower bounds are only offsets for the indices, so let us rather look at arr(3,2,1) As Byte.
Something is a bit mixed in your sentence, I think.
In the simpler example, the element would be arr(1,1,1).
Where do you find arr(0,1,0) and why?
 
arr(0,1,0) would be found at at the 3rd element.
This is because the 3rd dimension of the array has 0 to 1 as its bounds.
The 2nd dimension has bounds of 0 to 2, and 1st has bounds 0 to 3.
Because the array is listed with the highest dimension first arr(0,1,0) needs to go down none for the 1st and 3rd dimension because they are 0.
The second dimension has an offset of 2 because dimension3 has 2 elements in it.
Starting at the 1st element and offsetting leads you to the 3rd element.
 
00:00 - 21:0021:00 - 00:00

« first day (1414 days earlier)      last day (1766 days later) »