Click here to Skip to main content
15,794,629 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am getting error as "Value of type 'Date' cannot be converted to Long in "d1" values.

what is the problem...?

see code.
Dim StDate As Date = txtStartdate.Text 'Get the Start Date
    Dim EdDate As Date = txtEndDate.Text 'Get the End Date
    If txtEndDate.Text <> "" Then
        Dim weekYr As String = getWeek(EdDate)  'Get the Current Week
        lblEdWkYr.Text = weekYr 'Display the Week and Year
    End If
    If txtStartdate.Text <> "" And txtEndDate.Text <> "" Then
        Dim d1 As New Date(StDate.ToString)
        Dim d2 As New Date(EdDate.ToString)
        Dim M As Integer = Math.Abs((d1.Year - d2.Year))
        Dim months As Integer = ((M * 12) + Math.Abs((d1.Month - d2.Month)))

        txtDuration.Text = months
    End If
Updated 24-Jul-11 20:32pm

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900