I have an application that looks at various dates and compares those dates to yet another date for a time lapse. The problem is that I cannot figure out how to codefor the following scenario:
There is a receive date and an application date. There may be multiple application dates, but only one received date. I need to compare the MOST RECENT application date against the received date to determine a time lapse of greater than 10 days. When there are multiple application dates, I get multiple 10 day warnings, and rightly so according to the code as it is now:
DIM datagriditem6 As DataGridItem
ForEach datagriditem6 InMe.grdEquipment.Items
Dim receviedDate AsDate = CDate(Me.txtDateRecieved.Text)
Dim AppliedDate AsDate = CDate(datagriditem6.Cells(3).Text)
If receviedDate < (AppliedDate.AddDays(11)) Then
Else
Me.lblErrors.Text = Me.lblErrors.Text + "<br/>* Date Recieved is past 10 days of applied date"
EndIf
Next
So, I thought the way to do this in order to have only the most recent application date as the date being compared against the received date is to sort the array (datagriditem6), then compare against the largest date value. I can't see how to do this, however. I know array.sort(datagriditem6), but then how would I do the comparison with the most recent date?
There is a receive date and an application date. There may be multiple application dates, but only one received date. I need to compare the MOST RECENT application date against the received date to determine a time lapse of greater than 10 days. When there are multiple application dates, I get multiple 10 day warnings, and rightly so according to the code as it is now:
DIM datagriditem6 As DataGridItem
ForEach datagriditem6 InMe.grdEquipment.Items
Dim receviedDate AsDate = CDate(Me.txtDateRecieved.Text)
Dim AppliedDate AsDate = CDate(datagriditem6.Cells(3).Text)
If receviedDate < (AppliedDate.AddDays(11)) Then
Else
Me.lblErrors.Text = Me.lblErrors.Text + "<br/>* Date Recieved is past 10 days of applied date"
EndIf
Next
So, I thought the way to do this in order to have only the most recent application date as the date being compared against the received date is to sort the array (datagriditem6), then compare against the largest date value. I can't see how to do this, however. I know array.sort(datagriditem6), but then how would I do the comparison with the most recent date?