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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Formatting Hex in VB6

  • 28-11-2004 11:15am
    #1
    Registered Users, Registered Users 2 Posts: 3,977 ✭✭✭


    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, Registered Users 2 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, Registered Users 2 Posts: 3,977 ✭✭✭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