i Have a program in which VB.NET frontEnd and SQL Server2000 at the backend ,that should calculate dates as follows:
RETIREDATE = BIRTHDATE + 60YEARS. BirthDate should be input manually while RETIREDATE should be automatically displayed as a result of adding 60years to BIRTHDATE.The code doesnt work at all as it just keep display a strange RETIREDATE ie 01/01/0001,below is my code ;
VB Code:
Public Overloads Function DateAdd( _ ByVal Interval As DateInterval, _ ByVal Number As Integer, _ ByVal DateValue As DateTime _ ) As DateTime End Function
note: DOB stands for DATEOFBIRTHVB Code:
Private Sub txtDOB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDOB.Leave Dim rdate As DateTime Dim dob As DateTime rdate = DateAdd(DateInterval.Year, 60, txtDOB.Text) txtRetireDate.Text = rdate.ToShortDateString End Sub
txtRetireDate should be automatically displayed after txtDOB.text being lost focus (on leave event).
Is there any thing wrong with my code bove??please help




Reply With Quote