Click here to Skip to main content
15,902,737 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
MS Uses it for years. Type your Product Code starting in the first box, the next key (after 5 chars) lands into the next box, etc etc Any idea how to do that?

Regards,

:rose:
Posted

Hey... this is very easy to do.

Just on every keypress, check the length of the characters. If you find the limit, set focus to the next textbox.

You also need to track BackSpaces and do the reverse for it.

:)
 
Share this answer
 
Handle the EN_CHANGE Notification for all edit boxes.
Call GetDlgItemText on the lParam to get the text and check its length.
If the length is 5, call SetFocus to set the blinking cursor to the next edit box.
GetDlgItem gives you the handle to a control.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900