Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to add 2 byte array

Posted on 2006-11-02
3
Medium Priority
?
582 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
1 Comment
 
LVL 10

Accepted Solution

by:
gangwisch earned 200 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

877 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