Hello,
I have this problem with textboxes. For example in a textbox with value 2000/1/1, when i leave the textbox blank i cannot move the cursor to other textbox or close the form.
Any suggestions?
Thank you in advance.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Feb 23, 2010, 12:55 AM EST
private void textBox1_Leave(object sender, EventArgs e)
{
if (textBox1.Text.Trim() == "")
{
MessageBox.Show("You can not leave it Blank !!");
textBox1.Focus();
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (textBox1.Text.Trim() == "")
{
MessageBox.Show("You can not leave it Blank !!");
textBox1.Focus();
//Cancel Closing of Form
e.Cancel = true;
}
}
DealyRank #9,518 · 205 reputationPosted Feb 23, 2010, 8:24 PM EST
what i want to do though is to be able to get null values, not to obligate user to insert a date.
Sam HobbsRank #107 · 20.5K reputationPosted Feb 24, 2010, 7:34 AM EST