Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
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 18:10pm
Edited 18-Nov-12 20:56pm
Amit N. Saraf at 8-Nov-12 0:38am
How r u entering the date i.e r u using DateTimePicker or TextBox
a little more on what u r trying
Shahan Ayyub at 8-Nov-12 2:08am
Please also mention if its a Web application or windows based application
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

hoping txtDate.text is in dd/MM/yyyy format
on submit button click
if txtDate.text>= Format(Date.UtcNow(),"dd/MM/yyyy") Then
MsgBox("Please Write Past Date")

This code You can write in Submit button Click... if condition fails it will exitsub as per Upper code..
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
0 Suvendu Shekhar Giri 265
1 Sergey Alexandrovich Kryukov 260
2 Andy Lanng 185
3 PIEBALDconsult 180
4 OriginalGriff 130
0 Sergey Alexandrovich Kryukov 6,425
1 OriginalGriff 5,918
2 Peter Leow 2,514
3 Maciej Los 2,263
4 Abhinav S 2,249

Advertise | Privacy | Mobile
Web03 | 2.8.150414.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100