|
|
Source code |
1 2 3 4 5 6 7 |
Type MYTABLE Name As String Bytes() As Byte 'pointer to dynamic array Value As Long End Type Public Hallodri() As MYTABLE 'dynamic array |
|
|
Source code |
1 2 |
ReDim Preserve Hallodri(UBound(Hallodri) + 1) As MYTABLE ReDim Hallodri(UBound(Hallodri)).Bytes(0) |
|
|
Source code |
1 |
ReDim Preserve Hallodri(2).Bytes(UBound(Hallodri(2).Bytes) + 1) As Byte |
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
Option Explicit
Private Type MYTABLE
Name As String
Bytes() As Byte 'pointer to dynamic array
Value As Long
End Type
Private Hallodri() As MYTABLE 'dynamic array
Private s As String
Private Sub sh()
Dim lb As Integer
Dim t As String
lb = LBound(Hallodri)
t = "Hallodri(" & lb & " .. " & UBound(Hallodri) & ")." _
& "Bytes(" & LBound(Hallodri(lb).Bytes) & " .. " & UBound(Hallodri(lb).Bytes) & ")"
s = s & vbCrLf & t
Debug.Print t
End Sub
Private Sub Command1_Click()
Dim i As Integer
Dim ub As Integer
Debug.Print ""
s = ""
ReDim Hallodri(0 To 1)
For i = LBound(Hallodri) To UBound(Hallodri)
' ReDim Hallodri(i).Bytes(3 To 4)
With Hallodri(i)
ReDim .Bytes(3 To 4)
End With
Next i
sh
ub = UBound(Hallodri) + 1
ReDim Preserve Hallodri(ub) As MYTABLE
ReDim Hallodri(ub).Bytes(3 To 4)
For i = LBound(Hallodri) To UBound(Hallodri)
ub = UBound(Hallodri(i).Bytes) + 1
' ReDim Preserve Hallodri(i).Bytes(3 To ub) As Byte
With Hallodri(i)
ReDim Preserve .Bytes(3 To ub) As Byte
End With
Next i
sh
' ReDim Hallodri(LBound(Hallodri)).Bytes(3 To 3)
With Hallodri(LBound(Hallodri))
ReDim .Bytes(3 To 3)
End With
sh
ub = UBound(Hallodri(0).Bytes) + 1
' ReDim Preserve Hallodri(0).Bytes(3 To ub) As Byte
With Hallodri(0)
ReDim Preserve .Bytes(3 To ub) As Byte
End With
sh
MsgBox s, vbInformation, "Dynamic Arrays"
End Sub
|
Date of registration: Jul 16th 2008
Location: Erlangen, Germany
Occupation: Software Developer
Hobbies: Jabaco, game theory, text-mining
Thank you for the report. I'll fix this problem...
Quoted
That's a bummer that it doesn't work yet.
Sample:
Quoted
it seems that Jabaco doesn't have optional arguments in subs/functions either.
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 |
Public Sub test(Optional var1 As String = "test1", Optional var2 As String = "test2") MsgBox var1 & var2 End Sub Public Sub Command1_Click() Call test Call test("Replaced") 'Call test(, "Replaced") <<< not possible in java bytecode End Sub |
This post has been edited 1 times, last edit by "efgee" (Jul 10th 2009, 2:10am)
|
|
Source code |
1 2 3 4 5 6 7 8 9 |
Type MY_TYPE Name As String ChildArray() As Byte Characteristic As Long End Type Public ParentArray() As MY_TYPE ...... ReDim Preserve ParentArray(2).ChildArray(UBound(ParentArray(2).ChildArray) + 1) As Byte |