What do you think of doing an array like this?
Code:redim preserve aData(i)
aData(i) = array(strTypeSelected, strHTML)
Printable View
What do you think of doing an array like this?
Code:redim preserve aData(i)
aData(i) = array(strTypeSelected, strHTML)
Well, I wouldn't like you very much for implementing that in any project we worked on together... but if it works and takes far less code than the alternative, more to ya...
are those arguments really strings? that might cause some problems ...Quote:
Originally posted by jesus4u
What do you think of doing an array like this?
Code:redim preserve aData(i)
aData(i) = array(strTypeSelected, strHTML)
or is array a function?
function
Well if its a function, I don't understand what you are asking about? All you are doing is assigning a value to an element in an array.
You mean something like this:
VB Code:
Dim iCoords(0) As Variant iCoords(0) = Array(1, 2) MsgBox UBound(iCoords(0))
Pretty interesting, although I couldn't get it to work with anything but Variant.
Actually, he's creating a multidimensional array from a one-dimensional array, like in the code I posted above.Quote:
Originally posted by nemaroller
Well if its a function, I don't understand what you are asking about? All you are doing is assigning a value to an element in an array.
i still dont get the point of the thread ... is there something new or clever there that I am missing?
I believe he's asking whether or not it's a good method to use, or if he should declare them as multi-dimensional, to which I don't know the answer.Quote:
Originally posted by Muddy
i still dont get the point of the thread ... is there something new or clever there that I am missing?
But then again, I'm not him, so I can only speculate what he's asking.
You may just want to point an array to a type.
Type udt_something
strTypeSelected as string
strHTML as string
end type
dim aData() as udt_something
aData(i).strTypeSelected = "Something"
aData(i).strHTML = "HTML String"
seems to me that:
if you were wanting to conserve memory then this might save some (how much depends on how big the array is)
if you were wanting to conserve processor usage then a 2-d array would save some usage (how much depends on how many times the array is accessed)
Either way, if it is resource optimization that your after, you would probably be "splitting hairs" worrying about it at all.