I want the mask of the edit box to be up to "#######"

However, if the user only enters in two numbers, i only want it to be "##". This way, there are not extra spaces in the edit box. Does anyone know a quick solution on how i can create it dynamically.

I have been trying to create it on the key_press event of the edit box, but for some reason, its really not working like i want it. anyone, with any ideas would be helpful.

Thanks in advance