comparing dates in two textboxes

srivalli

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

in my form i have two textboxes and two date time pickers.

now when i select first datetimepicker1 in the textbox1 ,the format it should accept is dd/mm/yyyy

for that i took

Dim n As Date = DTP1.Value.ToShortDateString
txt1.Text = Format(n, "dd/MM/yyyy")

now when i select the date in second textbox using datetimepicker2 ,it should accept the date always greater than the date in the textbox1.

thank u
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,393
Location
Sydney, Australia
Programming Experience
10+
You can set the MinDate property of the second DateTimePicker in the ValueChanged event handler of the first. Is it really necessary to put the dates into TextBoxes? Is it not possible to just use the DateTimePickers and set a custom Format? Also if you want just the date part of a DateTime, which the Value property of a DateTimePicker is, just use the Date property, i.e. DateTimePicker.Value.Date.
 
Top Bottom