finance_teacher
asked on
C# MaskedTextBox -- ignore BLANK text ?
How can I change the below so when users remove a date from the below TEXTBOX and click "TAB" it goes to the next control ?
Currently FOCUS remains on the current control and their only option is to enter a bogus date like 09/09/2099.
private void dATE_DISTRUBUTEDMaskedText Box_Valida ting(objec t sender, CancelEventArgs e)
{
if (dATE_DISTRUBUTEDMaskedTex tBox.Text == " / /")
{
e.Cancel = true;
}
}
Currently FOCUS remains on the current control and their only option is to enter a bogus date like 09/09/2099.
private void dATE_DISTRUBUTEDMaskedText
{
if (dATE_DISTRUBUTEDMaskedTex
{
e.Cancel = true;
}
}
ASKER
That also fails, keeping focus in the original control.
According to following link, you can use this property of MaskedTextBox to go ahead with blank space:
dATE_DISTRUBUTEDMaskedText Box.ResetO nSpace = false;
http://stackoverflow.com/q uestions/8 334838/can -a-winform s-maskedte xtbox-allo w-spaces
dATE_DISTRUBUTEDMaskedText
http://stackoverflow.com/q
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Both of the above failed, e.Cancel ran, but kept focus on the current control.
<nextcontrol> being the name of the next control eg: textbox2