HEX values required

Abdul Hayee

Member
Joined
Mar 31, 2020
Messages
24
Programming Experience
Beginner
Hi Everyone.
some values are taken from user using textbox. The format is only digits. following it the sample of that
textbox_values.png

as we know if we read textbox data this should be in string format. to convert in into original format i use the following code.
code_withoutput.png

Now i want to convert the received data into HEX format as mentioned in Red Text.
How i can acheive that.
I dont want HEX in String format at that step because i want to calculate the CRC bits using these data. After calculating CRC i want a string format of whole to display on another text box.
Can you guide me regarding this?
 
Please don't post your code a screenshot(s). Please post your code in code tags.

Anyway, if you just want the debugger to display the values as hex, you can right click in the Autos or Variables pane and select "Hexadecimal Display" in the context menu.

I don't know why you would need to the decimal values to be displayed as hexadecimal. The CRC computation is agnostic of whether the byte value is being displayed as decimal, hex, octal, or binary.
 
I dont want HEX in String format at that step because i want to calculate the CRC bits using these data.
You seem to be under some misconceptions about numbers and number formats. A number is a number. How it is displayed doesn't change the value. Try this code:
C#:
var n1 = 16;
var n2 = 32;

var n3 = 0x10;
var n4 = 0x20;

var n5 = n1 + n2;
var n6 = n3 + n4;

if (n5 == n6)
{
    Console.WriteLine("Obviously the numeric format has no effect in the actual values.")
}
else
{
    Console.WriteLine("Houston, we have a problem.")
}
All numbers are binary in a computer. How they are represented to you is irrelevant to how the computer uses them.
 
Back
Top Bottom