Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2010 How convert array of type objects (but holding doubles) to array of type single?

$
0
0
Hi,

I have an Excel range which contains just numbers and I need to put in a 2 dimensional array of singles.

I've got the Excel range into an array of Objects:

Dim arrSheet_Obj(,) As Object
arrSheet_Obj = wksData_File.Range(wksData_File.Cells(2, 2), wksData_File.Cells(lNumWaves, lNumTimes)).Value

You can't dump the Excel range straight into an array of single as it can't convert the type.

I've tried to use array.ConvertAll, but can't work out the syntax

I've tried this as well:

Code:

arrSheet_Sing = CType(arrSheet_Obj, Single)
but it can't convert 2D array to single - obvious I suppose.

I'm just going to do a double loop for now, but would be nice to do it right.

Thanks

Kristian

Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>