|
-
May 1st, 2007, 04:45 PM
#1
Thread Starter
Member
[RESOLVED] Formatting a hexadecimal number.
I'm trying to force a four digit display of a hexadecimal number using:
Code:
something.text=format$(Hex(number),"0000")
This works if the resulting hex number is numeric, but for alphanumeric numbers it works strange. e.g.
4A yields 0000 <--- This is puzzling. Why only the "A" numbers?
4B yields 4B
4C yields 4C
...
4F yields 4F
I could pad with leading zeros, but maybe someone knows an easier way.
Thanks
Jon
-
May 1st, 2007, 04:51 PM
#2
Re: Formatting a hexadecimal number.
something.Text = Right$("000" & Hex(number), 4)
-
May 2nd, 2007, 10:33 AM
#3
Thread Starter
Member
Re: Formatting a hexadecimal number.
Thanks Joacim, that did the trick.
Jon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|