How do you get the LenB of an array? How do you call it??
Any ideas?
BW :cool:
Printable View
How do you get the LenB of an array? How do you call it??
Any ideas?
BW :cool:
Well usually you use LenB with UDT's, so i guess you could use it like this
It will show a empty variable length string array of 10 items will take up 44 bytesCode:Private Type sArray
s(10) As String
End Type
Private Sub Form_Load()
Dim a As sArray
MsgBox LenB(a)
End Sub
I need to redimension the array within a sub, will that still work if its in a UDT?
BW :cool:
You would need to redefine it then...
Code:Private Type sArray
s() As String
End Type
Private Sub Form_Load()
Dim a As sArray
redim a.s(30)
MsgBox LenB(a)
End Sub
I thought that might be it, hadn't tried it just yet. Good to hear its possible though.
BW :cool:
BTW is your website fully functional? Went to take a look, and it took a while (only got to the Kedaman.com site, not the Geocities site).
Yeah, geocities is a bit crappy today, well you can have a direct link here:
http://www.geocities.com/kedasu/homepage.htm
Unless you're using Variants or strings then you can just multiply the LenB of the first element by the number of elements, If it's a String use LenB(Join(Arr(),""))
Here's a quick Demo
Code:Private Sub Command1_Click()
Dim s(5 To 8) As String
Dim l(-4 To 9) As Long
Dim i As Integer
For i = 5 To 8
s(i) = "Hello" & Space(i)
Next i
For i = -4 To 9
l(i) = i
Next i
MsgBox LenB(Join(s, ""))
MsgBox LenB(l(LBound(l))) * (UBound(l) - LBound(l))
End Sub
Well done again Sam!