---
title: "find the length of array?"  
description: "find the length of array?"  
author: "Somesh"  
published: 2011-01-24  
updated: 2011-05-20  
canonical: https://www.mindstick.com/forum/155/find-the-length-of-array  
category: "vb script"  
tags: ["vb script"]  
reading_time: 1 minute  

---

# find the length of array?

how i can find the [length](https://www.mindstick.com/interview/1915/what-is-the-difference-between-char_length-and-length) of [Array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) in VB [script](https://www.mindstick.com/interview/477/how-can-i-execute-a-php-script-using-command-line)?\
Give the soln of its

## Replies

### Reply by Anonymous User

Hi.....

Use following code snippet to calculate length of array in vbscript

Dim NewArray(10)\
NewArray(0) = "Apple"\
MsgBox arrLength(NewArray)\
\
Function arrLength(vArray)\
\
ItemCount = 0\
\
For ItemIndex = 0 To UBound(vArray)\
If Not(vArray(ItemIndex)) = Empty Then\
ItemCount = ItemCount + 1\
End If\
Next\
arrLength = ItemCount\
End Function\


---

Original Source: https://www.mindstick.com/forum/155/find-the-length-of-array

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
