[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

convent ByteArray To DecimalArray

hay to All
What is the fastest way to convent a ByteArray To DecimalArray
thanks
0
sayeth
Asked:
sayeth
1 Solution
 
GrahamSkanCommented:
It isn't clear what you want to do. There is no type (in VB6 etc.) called decimal, so let us start with this.

    Dim bb(10) As Byte
    Dim dd() As Single
    Dim i As Integer
    
    '...
    ReDim dd(UBound(bb))
    For i = 0 To UBound(bb)
        dd(i) = CSng(bb)
    Next i

Open in new window

0
 
sayethAuthor Commented:
Thanks.  Just one little error problem i had to fix, but your answer is right
Dim bb(10) As Byte
Dim dd() As Single
Dim i As Integer
   
    '...
    ReDim dd(UBound(bb))
    For i = 0 To UBound(bb)
        dd(i) = BitConverter.ToSingle(bb, 0)
    Next i
thank for the help. but one more question  on the same topic. i wrote a code that convert single array to bytes array - it work fine but i want a faster way because the single array is very large
i= 0
For lvI = 0 To UBound(dd)     'dd is very large
   bb(i)= BitConverter.GetBytes(dd(lvI))
    i+4
Next
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now