how to pass a two dimensional dynamic array in a function
-
hi to all.. I have two dynamic array bOdt and bodtEntry byte arrays. which are declared as follow- Dim bOdt() As Byte Dim bOdtzentry() As Byte and I am passing BOdt in a function as two dimension array but still it is dynamic.Now I want to store this bOdt array in another array bOdtEntry and change size of the array. My code is as follow- Public Function fOdtEntry(count As Integer, bOdt() As Byte) As Variant Dim FlagRem As Integer Dim FlagDiv As Integer Dim RefCntr As Byte ReDim bOdtEntry(0 To count, 0 To 9) As Byte bOdtEntry = bOdt bOdtEntry(count, 0) = bGet(8) bOdtEntry(count, 1) = bGet(9) and so on.. On compilation it is giving an error."Subscribe out of range" Plz help what may be the problemmmmm?? Thanks in adv.
-
hi to all.. I have two dynamic array bOdt and bodtEntry byte arrays. which are declared as follow- Dim bOdt() As Byte Dim bOdtzentry() As Byte and I am passing BOdt in a function as two dimension array but still it is dynamic.Now I want to store this bOdt array in another array bOdtEntry and change size of the array. My code is as follow- Public Function fOdtEntry(count As Integer, bOdt() As Byte) As Variant Dim FlagRem As Integer Dim FlagDiv As Integer Dim RefCntr As Byte ReDim bOdtEntry(0 To count, 0 To 9) As Byte bOdtEntry = bOdt bOdtEntry(count, 0) = bGet(8) bOdtEntry(count, 1) = bGet(9) and so on.. On compilation it is giving an error."Subscribe out of range" Plz help what may be the problemmmmm?? Thanks in adv.
-
-
thanks for replay.. But i am not getting it. I am using base 0 and count is the ubound of array.... Can u explained in detail.. Thanks
If you are using Base 0 then look at the following example for an array called Names; Index - Item ------------- 0 - Fred 1 - Jim 2 - Bob 3 - Frank 4 - Jack Count = 5, LBound = 0, UBound = 4 So, Names(0) = Fred Names(4) = Jack Names(Count-1) = Jack Names(Count) = Out Of Limits Error Does that explain it better?
Dave Don't forget to rate messages!
Find Me On: Web|Facebook|Twitter|LinkedIn -
If you are using Base 0 then look at the following example for an array called Names; Index - Item ------------- 0 - Fred 1 - Jim 2 - Bob 3 - Frank 4 - Jack Count = 5, LBound = 0, UBound = 4 So, Names(0) = Fred Names(4) = Jack Names(Count-1) = Jack Names(Count) = Out Of Limits Error Does that explain it better?
Dave Don't forget to rate messages!
Find Me On: Web|Facebook|Twitter|LinkedIn