473,467 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Format Date

63 New Member
Hi,

How do I ensure that the correct date format is entered into a textBox?
Want to set Tag to false if incorrect format entered.

This format: dd/mm/yyyy

Expand|Select|Wrap|Line Numbers
  1. private void textBox_TextChanged(object sender, System.EventArgs e)
  2. {
  3.             TextBox tb = (TextBox)sender;
  4.  
  5.             if (tb.Text.Length == 0)
  6.             {
  7.                 tb.Tag = false;
  8.                 errorProvider1.SetError(tb, "Enter Data");
  9.             }
  10.             else
  11.             {
  12.                 tb.Tag = true;
  13.                 errorProvider1.SetError(tb, "");
  14.             }
  15. }
  16.  
May 18 '07 #1
3 1320
SammyB
807 Recognized Expert Contributor
Use a MaskedTextBox instead with a short date mask.
May 18 '07 #2
obrienkev
63 New Member
how do I set up the masked box?

thanks.
May 22 '07 #3
SammyB
807 Recognized Expert Contributor
how do I set up the masked box?

thanks.
In the properties window, mask property, short date mask
May 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
2
by: amith | last post by:
hi I have written javascript for comparing two dates in US format and finding out whether the start date is greater than the end date and vice versa. In this attempt i have instantiated the...
5
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
20
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the...
4
by: flyboy3300 | last post by:
I am trying to set up a form in db with items that have to be completed and when completed they check a "check box" and then I would like that to show a date/time in a text box. I have tried to use...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.