How do I allocate an array in memory dynamically and delete it?
Also how can I declare a struct in vb and access its members?
Printable View
How do I allocate an array in memory dynamically and delete it?
Also how can I declare a struct in vb and access its members?
Structs in VB are called types.
VB Code:
Private Type tExample dblVal as Double strVal as String End Type Dim exp as tExample 'in a sub exp.dblVal = 3.14159
to create a dynamic array:
VB Code:
Dim Ary() as Byte ReDim Ary(10) 'if you which to not wipe the memory ReDim Preserve Ary(20) 'to erase.. Erase Ary 'sets this basically to ary(), don't perform bound checks on this, it'll error 'you can use safearraygetdim API though