SyntaxFix
Write A Post
Hire A Developer
Questions
Use ToString("X4").
ToString("X4")
The 4 means that the string will be 4 digits long.
Reference: The Hexadecimal ("X") Format Specifier on MSDN.