Here ya go.

Dim arrOneDimension(2), arrTwoDimension(3, 3)

' Test for 1st dimension
If CheckDimensionOfArray("arrOneDimension", 1) Then
        Response.Write("arrOneDimension has at least one dimension.<br />")
Else
        Response.Write("arrOneDimension doesn't have one dimension.<br />")
End If

' Test for 2nd dimension
If CheckDimensionOfArray("arrOneDimension", 2) Then
        Response.Write("arrOneDimension has at least two dimensions.<br />")
Else
        Response.Write("arrOneDimension doesn't have two dimensions.<br />")
End If  

' Test for 1st dimension
If CheckDimensionOfArray("arrTwoDimension", 1) Then
        Response.Write("arrTwoDimension has at least one dimension.<br />")
Else
        Response.Write("arrTwoDimension doesn't have one dimension.<br />")
End If

' Test for 2nd dimension
If CheckDimensionOfArray("arrTwoDimension", 2) Then
        Response.Write("arrTwoDimension has at least two dimensions.<br />")
Else
        Response.Write("arrTwoDimension doesn't have two dimensions.<br />")
End If  

Function CheckDimensionOfArray(sArrayName, iDimension)
        Dim bHasDimension
        
        ' First, check to see if the name passed in is an array.
        If Eval("IsArray(" & sArrayName & ")") Then
                On Error Resume Next
                Eval("UBound(" & sArrayName & ", " & iDimension & ")")
                ' Error number 9 is "Subscript out of range: 'UBound'"
                bHasDimension = Not (Err.number = 9)
                Err.Clear
                On Error Goto 0
                CheckDimensionOfArray = bHasDimension
        Else
                CheckDimensionOfArray = False
        End If
End Function


HTH,
Greg

-----Original Message-----
From: Rajput, Goutam [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 31, 2003 1:02 PM
To: [EMAIL PROTECTED]
Subject: [wdvltalk] Is Array Single or Multidimensional?


Is there a way to find out if a array is single or multidimensional in
vbscript? Any help is appreciated.

Thanks



The information in this electronic mail message is sender's business
Confidential and may be legally privileged.  It is intended solely for the
addressee(s).  Access to this Internet electronic mail message by anyone
else is unauthorized.  If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it is prohibited and may be unlawful. 
The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent. This message and
its attachments could have been infected during  transmission. By reading
the message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects. Galileo International is not liable for any loss or damage
arising in any way from this message or its attachments.



____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to