Results 1 to 3 of 3

Thread: how to turn any decimal number into a hexadecimal in vb.net?

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    how to turn any decimal number into a hexadecimal in vb.net?

    how do i do that?

  2. #2
    Junior Member
    Join Date
    Jan 2001
    Location
    Durham, NC
    Posts
    28
    Try this

    VB Code:
    1. dim NumberToConvert as integer
    2. dim NumberAsHex as string
    3.  
    4. NumberToConvert = 20 'Set this to the number you want to convert to hex
    5. NumberAsHex = Hex(NumberToConvert)

  3. #3
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Even simplier, use the ToString() method, and supply a format string arg:

    Code:
    MessageBox.Show(NumberToConvert.ToString("X"))

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