Yay! My code works...
'Retrieve the earliest & latest date recorded in info.csv to get the range of days covered
Sub GetNumberOfDays()
Dim begDate As DateTime
Dim endDate As DateTime
Dim numRows As Integer
Dim timeDiff As TimeSpan
Dim numDays As Integer
Try
begDate = CDate(dgvReport.Rows(0).Cells(0).Value)
numRows = dgvReport.RowCount
endDate = CDate(dgvReport.Rows(numRows - 2).Cells(0).Value)
timeDiff = endDate.Date - begDate.Date
numDays = timeDiff.Days
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
MessageBox.Show(CStr(numDays))
End Sub
My tribute to TechRepublic for passing on the tip. Thanks Irina Medvinskaya!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment