0

I'm trying to automatically convert a binary input in a textbox to a hex code in a second textbox.

It does work the way I'm trying to, but the order it comes out is wrong, for instance, 1111 = 0F this is correct, but when i now make it :
11111 i get 1F out of it what is of course wrong.

my code is:

private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string hex;
            string hexwaarde;
            try
            {
                hex = textBox1.Text;
                hexwaarde = String.Format("{0:X2}", Convert.ToInt32(hex, 2));
                textBox2.Text = hexwaarde;
            }
            catch{}
        }

thanks in advance,
NdZ

2
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by ndz-niels
0

just so you know....

11111 = 1F...
1111 = 0F...

so whats the problem then?

Edited by phoenix911: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.