Solved

how to add 2 byte array

Posted on 2006-11-02
3
572 Views
Last Modified: 2008-03-06
how to add 2 byte array. ie
            Dim b1() As System.Byte = {48, 48, 50, 49, 48, 49, 49, 48, 242, 56, 0, 1, 14, 192, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0}
            Dim b2() As System.Byte = Encoding.ASCII.GetBytes("02300110")
0
Comment
Question by:ANKHAA
3 Comments
 
LVL 10

Accepted Solution

by:
gangwisch earned 50 total points
ID: 17858661
       Dim b3() As System.Byte
        Dim b1() As System.Byte = {48, 48, 50, 49, 48, 49, 49, 48, 242, 56, 0, 1, 14, 192, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0}
        Dim b2() As System.Byte = System.Text.Encoding.ASCII.GetBytes("02300110")
        If b1.Length > b2.Length Then
            For i As Integer = 0 To b1.Length - 1
                If b2.Length <= b1.Length Then
                    b3(i) = b1(i) + b2(i)
                Else
                    b3(i) = b1(i)
                End If
            Next
        Else
            'b2>=b1.length
            For i As Integer = 0 To b2.Length - 1
                If b1.Length <= b2.Length Then
                    b3(i) = b1(i) + b2(i)
                Else
                    b3(i) = b2(i)
                End If
            Next
        End If

b3 will contain your answer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question