Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Formatting Hex in VB6

Options
  • 28-11-2004 12:15pm
    #1
    Registered Users Posts: 3,969 ✭✭✭


    I need to format a load of hexadecimal numbers. They go from 0 to FFFFFF. If I try to use

    Format(Text1.Text, "000000")

    saying text1.text contains 4104F, it returns 4104F. I need it to return 04104F. Is there any way to do it? And the hex length is varying, could be 2 characters, like 4A or 6 chars like 564A89.


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    I've had similiar problems with the Format function in the past. I wrote my own little format function and used that instead. You need to loop determine how many preceeding zeros you need and then add them to the string which represents your hex value.


  • Registered Users Posts: 3,969 ✭✭✭mp3guy


    could you give me a little help with that? I've no idea how to say "If there 1 char, add 5 "0"'s, if theres 2 chars add 4 "0"'s etc..." In visual basic


Advertisement