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 4621236
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:40:18+00:00 2026-05-22T02:40:18+00:00

I understand the concept of bytes and declaring variables to save on processing space.

  • 0

I understand the concept of bytes and declaring variables to save on processing space. I understand that the max value that can be stored in a byte is 255.

I cannot seem to wrap my head around my current issue and was hoping that someone would be able to educate me and help me solve this problem. I don’t have much experience working with byte manipulation.

I was given a project to update and was told that the service that is passing data to my project would start using 2bytes to transfer the ID rather than the 1 byte previously as their parameters have grown.

The current declaration for the variable is:

Dim bytvariable As Byte = 0

What is the new declaration to accept a 2 byte value?

Secondly, how would I be able to convert that 2 byte value into an integer number?

Example, they are passing me this value: 0x138 and it is supposed to come out as 312.

Thank you in advance.

  • 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-05-22T02:40:19+00:00Added an answer on May 22, 2026 at 2:40 am

    Here’s a summary of the “primitive” datatypes in .NET, and their sizes.

    Yes, an Int16 is probably what you want.

    Often you’d be reading the binary data from a stream, or getting it from an array of bytes.
    To convert from those sources into an Int16, you can do this:

    in C#:

    byte[] block = new byte[128];
    mystream.Read(block, 0, block.Length);
    int i = 0;
    Int16 value = (Int16)(block[i++] + block[i++] * 256);
    

    In VB.NET, it would be:

    Dim block as New Byte(128)
    stream.Read(block, 0, block.Length)
    Dim i as Int16 = 0
    Dim value As Short = CShort((block(i) + (buffer(i+1) * &H100)))
    i = i + 2
    

    (I think)

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

Sidebar

Related Questions

I can't understand the concept and, first of all, where it belongs. Is it
What's the concept behind zip compression? I can understand the concept of removing empty
I understand the IOC concept, which we can mix-and-match different classes using wiring. Every
I can understand Appdomain concept, but small doubt is One Process -> many application
I can't really understand this concept. Assuming i have this interface: public interface IValidate
I don't understand the concept of postfix and prefix increment or decrement. Can anyone
I am trying to understand the concept of Beat Detektion and I found that
I'm just trying to see if I can fully understand the concept of static
I understand that a stream is a representation of a sequence of bytes. Each
I understand the concept and reasons behind using the using statement, and I use

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.