Domino 9 und frühere Versionen > ND6: Entwicklung

Grenzen für arrays bei arrayAppend?

<< < (2/2)

m3:
Sorry, ich dürfte da falsch gelegen sein. Anscheinend gibts ein Limit.


--- Code: --- Dim sourceArray1(1 To 12) As Integer
Dim sourceArray2(1 To 12) As Integer
Dim arr3
sourceArray1(1) = 1
sourceArray1(2) = 2
sourceArray1(3) = 3
sourceArray1(4) = 4
sourceArray1(5) = 5
sourceArray1(6) = 6
sourceArray1(7) = 7
sourceArray1(8) = 8
sourceArray1(9) = 9
sourceArray1(10) = 10
sourceArray1(11) = 11
sourceArray1(12) = 12
sourceArray2(1) = 1
sourceArray2(2) = 2
sourceArray2(3) = 3
sourceArray2(4) = 4
sourceArray2(5) = 5
sourceArray2(6) = 6
sourceArray2(7) = 7
sourceArray2(8) = 8
sourceArray2(9) = 9
sourceArray2(10) = 10
sourceArray2(11) = 11
sourceArray2(12) = 12
sourceArray2(13) = 13
sourceArray2(14) = 14

arr3 =  Arrayappend (sourceArray1, sourceArray2)

Msgbox "UBound neues Array: " & Cstr(Ubound(arr3))
--- Ende Code ---

Selber Fehler wie bei Dir.  :(

koehlerbv:
Könnte das damit zu tun haben, dass Option Base 0 ist, aber die Arrays als (1 to 12) deklariert worden sind?

Bernhard

m3:
Danke.
* m3 holt sich noch einen Kaffee, damit er mal was sieht und grad Denken kann.
Mit korrektem Dim klappt es natürlich:

--- Code: ---Dim sourceArray1(1 To 12) As Integer
Dim sourceArray2(1 To 15) As Integer
Dim arr3
sourceArray1(1) = 1
sourceArray1(2) = 2
sourceArray1(3) = 3
sourceArray1(4) = 4
sourceArray1(5) = 5
sourceArray1(6) = 6
sourceArray1(7) = 7
sourceArray1(8) = 8
sourceArray1(9) = 9
sourceArray1(10) = 10
sourceArray1(11) = 11
sourceArray1(12) = 12
sourceArray2(1) = 1
sourceArray2(2) = 2
sourceArray2(3) = 3
sourceArray2(4) = 4
sourceArray2(5) = 5
sourceArray2(6) = 6
sourceArray2(7) = 7
sourceArray2(8) = 8
sourceArray2(9) = 9
sourceArray2(10) = 10
sourceArray2(11) = 11
sourceArray2(12) = 12
sourceArray2(13) = 13
sourceArray2(14) = 14

arr3 =  Arrayappend (sourceArray1, sourceArray2)

Msgbox "UBound neues Array: " & Cstr(Ubound(arr3))
--- Ende Code ---


Und das, nachdem ich Bill Buchans "Best Practices" bereits mehrmals gehört habe:


--- Zitat ---By default, they count from zero
Don't change this by using “option base”
You can guarantee that someone will either:
    +) Cut'n'paste this code somewhere else
    +) Remove your “option base” directive!

--- Ende Zitat ---

DAU-in:
Ich glaube, ich weiss jetzt, wo der Fehler liegt, mal sehen.

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln