Click here to Skip to main content
Sign Up to vote bad
good
See more: VB.NET
manually i am entering the date .....the date which i enter should be a previous date and should not be a present or future date..if i enter present or future date it should throw error..please help me with the code...It is a mobile web application.. and i am not using date and time picker instead i am using text box
Posted 7 Nov '12 - 17:10
Edited 18 Nov '12 - 19:56

Comments
Amit N. Saraf - 8 Nov '12 - 0:38
How r u entering the date i.e r u using DateTimePicker or TextBox a little more on what u r trying
Shahan Ayyub - 8 Nov '12 - 2:08
Please also mention if its a Web application or windows based application

2 solutions

Compare the date to today and reject it if it is later. Simple algorithm really, and the code will probably need to use the DateTime structure[^] and its methods.
  Permalink  
hoping txtDate.text is in dd/MM/yyyy format
on submit button click
if txtDate.text>= Format(Date.UtcNow(),"dd/MM/yyyy") Then
txtDate.text=""
MsgBox("Please Write Past Date")
EndIf
ExitSub
 
This code You can write in Submit button Click... if condition fails it will exitsub as per Upper code..
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 508
1 Arun Vasu 275
2 Mahesh Bailwal 259
3 Maciej Los 238
4 Rohan Leuva 176
0 Sergey Alexandrovich Kryukov 9,660
1 OriginalGriff 7,329
2 CPallini 3,968
3 Rohan Leuva 3,339
4 Maciej Los 2,851


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid