comparing the retrieved date with the entering date

srivalli

Well-known member
Joined
May 4, 2005
Messages
189
Programming Experience
Beginner
hello,

i am retrieving some date in a textbox1, with the help of datetimepicker1.
In my form i have one more textbox2 and datetimepicker2.

now my query is

after retrieving the date in TB1 from the back end,i want to select some date in TB2 which is always greater than the retrieved date.

Is it possible to compare the dates .
 
well, i dont want to compare the values.Instead i want to enter the value in a textbox2 which is always greater than the value retrieved from the backend in textbox1.

thks

kulrom said:
myVar = system.DateTime.Compare(date1, date2)

method will return integer which is -1 if date1 is less than date2, 0 if both dates are equal and 1 if date1 is bigger than date2

cheers ;)
 
I don't understand why you are using TextBoxes at all if you have DateTimePickers. DateTimePickers have a Value property if you want a DateTime object and a Text property if you want the displayed string. What purpose do the TextBoxes serve?
 
here i am selecting textbox to store a date using datetimepicker because, i want to store this date in the back end and also i can select any date in the picker.
i know only one option to store the date in any control. if there is any other option then let me know.
jmcilhinney said:
I don't understand why you are using TextBoxes at all if you have DateTimePickers. DateTimePickers have a Value property if you want a DateTime object and a Text property if you want the displayed string. What purpose do the TextBoxes serve?
 
The DateTimePicker has MinDate and MaxDate properties to limit input. Also it can be data bound or you can use the Value or Text properties to transfer your date value to and from a DataTable or SQL statement.
 
Back
Top