Results 1 to 6 of 6

Thread: HEX values

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    HEX values

    Does anyone know how to convert integer values to hex values in C#. It is really easy to do in VB but I am not seeing a way in the documentation on how to do it in C#. I would really hate to have to write a class in VB just to use in C#.

    Thanks
    Jeremy

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Sure..

    Code:
       myNumber.ToString("X");
    Could it get any easier??

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    Thanks.

    Jeremy

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    and from hex to decimal?
    \m/\m/

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    The funny part is I know how to get from hex, I just couldn't get there. So here is the answer to your question.

    PHP Code:
    System.Windows.Forms.MessageBox.Show(Convert.ToInt16("ABC",16).ToString()); 
    Jeremy

  6. #6
    Lively Member neodatatype's Avatar
    Join Date
    Aug 2002
    Location
    Italy
    Posts
    103

    PHP Code:
    System.Windows.Forms.MessageBox.Show(Convert.ToInt16("ABC",16).ToString()); 
    I use this

    PHP Code:
    MyNumber Int64.Parse(ValueGlobalization.NumberStyles.AllowHexSpecifier
    What's the difference (better/worse)?
    > NeoDataType.net <

    Try my Free .Net Reporting Tool!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width