|
-
May 25th, 2004, 03:52 PM
#1
Thread Starter
Member
Resolved_how can i tell if adynamic array is empty???
ubound(myArray) - gives error
isEmpty doesn't work
Please Help me! I'm stuck
Last edited by Janeen228; May 25th, 2004 at 04:11 PM.
-
May 25th, 2004, 03:57 PM
#2
Hyperactive Member
You need the help of an API:
VB Code:
Option Explicit
Private Declare Function SafeArrayGetDim Lib "oleaut32" (ByRef saArray() As Any) As Long
Private Sub Form_Load()
Dim testarray() As String
Debug.Print SafeArrayGetDim(testarray)
End Sub
If the return value is greater than 0 then the array is dimensioned, otherwise it's not.
-
May 25th, 2004, 04:08 PM
#3
Thread Starter
Member
Resolved!!!!
Thank you sooooo much!!!!
-
May 25th, 2004, 06:10 PM
#4
You can also do it without an API like this.
Code:
Public Function IsDimmed(byRef vArray As Variant) As Boolean
On Error goto Erro:
'This causes an Handled error if the array isn't dimmed
'and returns False
IsDimmed = IsNumeric(UBound(vArray))
Erro:
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|