About
Pricing
Community
Teams
Start Free Trial
Log in
finance_teacher
asked on
3/14/2012
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;
}
}
C#
.NET Programming
5
1
Last Comment
finance_teacher
8/22/2022 - Mon
Brendan M
3/14/2012
try <nextcontrol>.Focus();
<nextcontrol> being the name of the next control eg: textbox2
finance_teacher
3/14/2012
ASKER
That also fails, keeping focus in the original control.
gery128
3/14/2012
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
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER CERTIFIED SOLUTION
gery128
3/14/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
finance_teacher
3/14/2012
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