Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:34:48+00:00 2026-06-04T00:34:48+00:00

I have a textbox on a form where a person types in a byte

  • 0

I have a textbox on a form where a person types in a byte array into in the format shown below.

My question is how can I then convert the string array produced into a byte array of the same values?

so this would be entered into the text box :

0x11, 0x01, 0x49, 0x4D, 0x41, 0x47, 0x45, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x53, 0x75, 0x6D, 0x6D, 0x61, 0x72, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

the following code then splits it and converts it to a byte array

string text = txtChecksumText.Text;
        string[] parts = text.Split(new string[] { ", " }, StringSplitOptions.None);
        byte[] bytes = new byte[parts.Length];

        for (int i = 0; i < parts.Length; i++)
        {
            bytes[i] = Convert.ToByte(parts[i], 16); // this isn't working as expected
            txtResponse.Text += Environment.NewLine + "     " + i + " = " + parts[i] + " = " + bytes[i].ToString() ;
        }

and the response to show it isn’t working

 0 = 0x11 = 17
 1 = 0x01 = 1
 2 = 0x49 = 73
 3 = 0x4D = 77
 4 = 0x41 = 65
 5 = 0x47 = 71
 6 = 0x45 = 69
 7 = 0x31 = 49
 8 = 0x00 = 0
 9 = 0x00 = 0
 10 = 0x00 = 0
 11 = 0x00 = 0
 12 = 0x00 = 0
 13 = 0x00 = 0
 14 = 0x00 = 0
 15 = 0x00 = 0
 16 = 0x00 = 0
 17 = 0x00 = 0
 18 = 0x00 = 0
 19 = 0x00 = 0
 20 = 0x00 = 0
 21 = 0x00 = 0
 22 = 0x00 = 0
 23 = 0x01 = 1
 24 = 0x53 = 83
 25 = 0x75 = 117
 26 = 0x6D = 109
 27 = 0x6D = 109
 28 = 0x61 = 97
 29 = 0x72 = 114
 30 = 0x79 = 121
 31 = 0x00 = 0
 32 = 0x00 = 0
 33 = 0x00 = 0
 34 = 0x00 = 0
 35 = 0x00 = 0
 36 = 0x00 = 0
 37 = 0x00 = 0
 38 = 0x00 = 0
 39 = 0x00 = 0
 40 = 0x00 = 0
 41 = 0x00 = 0
 42 = 0x00 = 0
 43 = 0x00 = 0
 44 = 0x00 = 0
 45 = 0x00 = 0
 46 = 0x00 = 0
 47 = 0x00 = 0
 48 = 0x00 = 0
 49 = 0x00 = 0
 50 = 0x00 = 0
 51 = 0x00 = 0
 52 = 0x00 = 0
 53 = 0x00 = 0
 54 = 0x00 = 0
 55 = 0x00 = 0

Just to be clear, the 0x11 should come back as a byte 11 not byte 17, same with all the others I’m not trying to convert to decimal i’m trying to convert the string of literal bytes to a byte array for check-sum creation

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:34:50+00:00Added an answer on June 4, 2026 at 12:34 am

    The bytes you’re getting are just bytes; they aren’t intrinsically decimal or hexadecimal.

    If you want to pass the bytes to something else (for a checksum), they’re fine.

    Your only problem is that you’re writing them to the console in decimal form – use ToString("x") if you wish to write them out in hexadecimal form for any reason.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

C# question: I have a textBox in a default form Form1 and I want
I have a few asp:textbox controls in a form on a webpage, below is
I have a form in MVC: <% using (Html.BeginForm(Get, Person)) { %> <%= Html.TextBox(person_id)%>
I have got a textbox on a form with a method being called from
I have a web form where I have a textbox in which the user
I have a Form with TextBox on it like this: Form f = new
I have to add a textbox inside a form that is composed of a
I have a form with Name textbox Address textbox Phone textbox Insert buttion and
i have an asp.net form and an asp:textbox. i have a problem when the
I have a dropdownlist and a textbox with a button on a form. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.