To reproduce:
- Add a blank mask to a form and set its Mask type to Standard.
- Set its mask to "###-##-##";
- Set its PromptChar to a single space.
- Now set the caret before the '-' and type a two digits (the first digit is overridden by the second because the caret is not moved properly).
Workaround:
Subscribe to the following KeyDown event:
void box1_KeyDown(object sender, KeyEventArgs e)
{
int caretPos = this.box1.MaskedEditBoxElement.TextBoxItem.SelectionStart;
if ((e.KeyCode != Keys.Left && e.KeyCode != Keys.Right) && (e.KeyCode != Keys.Up && e.KeyCode != Keys.Down))
{
if (caretPos < box1.Text.Length && box1.Text[caretPos] == '-')
{
this.box1.MaskedEditBoxElement.TextBoxItem.SelectionStart++;
}
}
}