Results 1 to 4 of 4
  1. #1
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused

    Question [Help]Convert decimal to Hex[Solved]

    What is the function to convert decimal to hex?

  2. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Numerous

    Note: wherever it says FromBase you can actually set the base
    Example: 16,32,8,etc.

    or just leave it as frombase

    [php]
    Convert a binary, octal, hexadecimal value to decimal


    Dim byteC As Byte = Convert.ToByte(value, fromBase)
    Dim ShortC As Short = Convert.ToInt16(value, fromBase)
    Dim IntegerC As Integer = Convert.ToInt32(value, fromBase)
    Dim longC As Long = Convert.ToInt64(value, fromBase)
    [/php]

    or

    [php]
    Dim dec As Integer = "Integer Value"
    Dim hex As String = dec.ToString("X")
    Dim decAgain As Integer = Integer.Parse(hex, System.Globalization.NumberStyles.HexNumber)
    [/php]

    [php]
    Textbox1.text =Conversion.Hex(integer)
    [/php]

    [php]
    Msgbox(Conversion.Hex(integer))
    [/php]

    [php]
    Dim Val As Integer
    Val = Convert.ToInt32("To Convert here", FromBase)
    [/php]

    16 being the base integer.
    You can change that.

    [php]
    Dim s as string = "FF"
    Dim value as Integer

    value = val( "&h" & s )
    [/php]

    [php]
    label1.text =Conversion.Hex(integer)
    [/php]

    or whatever

    Last edited by NextGen1; 04-28-2010 at 07:58 PM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  3. The Following User Says Thank You to NextGen1 For This Useful Post:

    ppl2pass (04-28-2010)

  4. #3
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    the values arent correct.

    here is a list

    Decimal:
    0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

    Hex:
    0 1 2 3 4 5 6 7 8 9 A B C D E F

    so 10 = A
    11 = B...

    nvm found it

    MsgBox(Conversion.Hex(integer))
    Last edited by ppl2pass; 04-28-2010 at 05:29 PM.

  5. #4
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Solved then


     


     


     



    The Most complete application MPGH will ever offer - 68%




Similar Threads

  1. [help] making a text to hex converter and vice versa[Solved]
    By PixyStyx in forum Visual Basic Programming
    Replies: 5
    Last Post: 12-31-2010, 03:30 PM
  2. [Help]Convert VB6 code to VB.NET[Solved]
    By nathanael890 in forum Visual Basic Programming
    Replies: 13
    Last Post: 08-07-2010, 12:11 AM
  3. [Help]Converting Char to Decimal[Solved]
    By Lolland in forum Visual Basic Programming
    Replies: 2
    Last Post: 07-22-2010, 06:35 AM
  4. [Help]String to Hex[Solved]
    By ppl2pass in forum Visual Basic Programming
    Replies: 5
    Last Post: 04-27-2010, 07:55 AM
  5. [help]Convert String to Color[Solved]
    By mnpeepno2 in forum Visual Basic Programming
    Replies: 10
    Last Post: 04-02-2010, 01:08 PM