Hello All,
Actually i was filling the array with the range then i am not able to ready array items when trying to read its throws error Index was outside the bounds of the array,below is my code .Please help me .
Dim ExcelRangeArray(14, 0),arValue
ExcelRangeArray = objApp.Sheets("Sheet1").Range("A4:A14").Value
Here ExcelRangeArray contains all the data from a1 to a 14 but not able to read the values
arValue =ExcelRangeArray(5,0) -> This throws error
Thanks & Regards,
Sampath
sampath mekaPosted May 6, 2016, 7:29 AM
Bhuvanesh MohankumarPosted May 6, 2016, 6:12 AM
Idon't have option to debug your code,
Can you check this link, where when you readcontent from a file to an array itthrows some error [Index was outside the bounds of the array.].
Dim vFileName As String = "C:\Bhuvan\student.txt"
Using rvSR As New IO.StreamReader(vFileName)
vstring = rvSR.ReadLines().Select(Function(s) s.Split(","c)(0)).ToArray()
End Using
End If
sampath mekaPosted May 6, 2016, 6:04 AM
Bhuvanesh MohankumarPosted May 6, 2016, 5:57 AM
Is that declaration of array is fine, I am unable to test here and not sure about the code,
Example: Dim strData(,) As String
sampath mekaPosted May 6, 2016, 5:46 AM
Bhuvanesh MohankumarPosted May 6, 2016, 5:36 AM
ExcelRangeArray = objApp.Sheets("Sheet1").Range("A4:A14").Value
Do a null check ofExcelRangeArray, I believe the value is not assigned to array at all.
sampath mekaPosted May 6, 2016, 5:31 AM
Bhuvanesh MohankumarPosted May 6, 2016, 5:29 AM
I have a doubt here sampath,
can you say is this value also throw error?