Author: levitage | Posted on: 6/24/2008 12:59:21 AM | Views : 277

Hie,  
I have 2 textbox that is linked to the calendar. The 2 textbox are txtStartDate and txtEndDate. Means when the user click the calendar, the date will appear in the textbox.
how do i calculate the difference in days between the 2 dates when i click a button name Button1 and then the number of days will appear in another label name lblDays
I tried doing the codes but it doesn't shows the difference in days:
The following is my codes:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim dtStart, dtEnd
        dtStart = CType(txtStartDate.Text, Date)
        dtEnd = CType(txtEndDate.Text, Date)
        Dim difference
        difference = DateDiff("d", dtStart, dtEnd)
Go to the complete details ...