I am trying to add a space after the 3rd or 4th character in a text box depending on the total characters.
For example If the text box value contains 6 characters, then add a space after the 3rd character. If the text box value contains 7 characters, then add a space after the 4th character.
Example for 7 Characters in a text box
Example for 6 Characters in a text box
Where I am currently at with trying to get this to work.
private void FirstPostcode_LostFocus(object sender, RoutedEventArgs e)
{
if (FirstPostcode.Text.Length == 3)
{
FirstPostcode.Text += " ";
}
}
Any help would be appreciated. Thanks.