Click here to Skip to main content
15,886,639 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear all
My team leader asked me if there is a possible way to create a user control that takes date values only with the format "dd/MM/yyyy" and prevent any other value or format to be entered (either by keyboard or paste) in this text box; by using VB.NET.
Can you help me please
Posted
Comments
Sergey Alexandrovich Kryukov 17-Dec-11 23:18pm    
A vote of 1 by the reason I explained in my comment. Please, play a fair game or find another way to get help.
--SA

 
Share this answer
 
v3
Comments
fadi77_net 17-Dec-11 8:27am    
Guys; I know that, but my team leader do not want to use calender, date time picker, or masked textbox, he want me to create a user control by using textbox to prevent user to enter non date value either by using keyboard or past
thatraja 17-Dec-11 8:47am    
check my updated answer
Sergey Alexandrovich Kryukov 17-Dec-11 23:14pm    
Please see my comment to the answer by Griff.
--SA
fadi77_net 17-Dec-11 8:52am    
Thatraja,I am using windows application, not web application, your updated answer is in java script
thatraja 17-Dec-11 9:05am    
check my updated answer again
 
Share this answer
 
Comments
fadi77_net 17-Dec-11 8:27am    
Guys; I know that, but my team leader do not want to use calender, date time picker, or masked textbox, he want me to create a user control by using textbox to prevent user to enter non date value either by using keyboard or past
OriginalGriff 17-Dec-11 10:22am    
If you are using a windows app (as you state in your reply to thatraja's solution, then a Calender is wrong. Use a DateTimePicker instead - it can act like a text box and not show a drop down, but it has two advantages:
1) It displays in tyeh users preferred date format, rather than your team leaders.
2) It means you don't have to do any validation to ensure the user has entered a real date, rather than 99 99 9999, or 31st February.
If your team leader absolutely requires a text box to do this, he is an idiot.
Or this is your homework.
Sergey Alexandrovich Kryukov 17-Dec-11 23:13pm    
My 5, but not for an answer, for a comment.
This is very inappropriate, when a person not really responsible for a solution asks a question and then impose a limitation referring to some "authority".

This is the abuse. Why should we waste time for such question? Let this "team leader" call us, and let OP resolves their problems about relationships by himself.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900