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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Feb 24, 2010, 12:34 PM
DealyPosted Feb 24, 2010, 1:24 AM
what i want to do though is to be able to get null values, not to obligate user to insert a date.
Kirtan PatelPosted Feb 23, 2010, 5:55 AM
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;
}
}