C # How to send numericUpDown value to textBox in Hexadecimal?

3

then ... numericUpDown even has the Hexadecimal count format, however when sending to texBox it counts only in decimal is there any way the textBox can get the given numeric value in Hexadecimal?

I send the numeric value to the textBox like this:

    private void numericUpDown1_ValueChanged(object sender, EventArgs e)
    {
        textBox1.Text = Convert.ToString(numericUpDown1.Value);
    }
    
asked by anonymous 26.03.2017 / 23:28

1 answer

3

It is only you to make a parse for integer and call the ToString method with the formatting X2 for two digits in hexadecimal.

textBox1.Text = ((int)numericUpDown1.Value).ToString("X2");
    
26.03.2017 / 23:40