Hi friends,
I need to convert the object array value to the double array value in vb.net?
Following is my code:
dim s() as object dim ss as string ss="5.6,7.8,6.7" s=split(s,",") dim d() as doube
Now i have to convert the object Array ( s ) to Double array (d).
How to convert this?
When trying this , i get the following error:
Value of type '1-dimensional array of object' cannot be converted to '1-dimensional array of double' because 'object' is not derived from 'double'
Thanks in Advance
|
| Author: Neetu 03 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
Hi dear. Try this code.
Sub Main() Dim s() As Object Dim ss As String ss = "5.6,7.8,6.7" s = ss.Split(",") Dim d(s.Length - 1) As Double ' d = CType(s, Double()) Dim a As Object Dim i As Integer i = 0 For Each a In s d(i) = CDbl(a) i = i + 1 Next
Dim d1 As Double For Each d1 In d System.Console.WriteLine(d1) Next End Sub
regards Neetu
|