I\'m a SQL guy, but I need a function to calculate the number of weekdays between two dates in VB.NET. I don\'t need to worry about holidays. My attempts unfortunately have
'This is my version vb.net 2013 and its works
Private Sub enddate_ValueChanged(sender As Object, e As EventArgs) Handles enddate.ValueChanged
Dim countsun As Integer = 0
Dim countsat As Integer = 0
Dim nonholiday As Integer = 0
Dim totalDays = (enddate.Value - startdate.Value).Days
For i = 0 To totalDays
Dim Weekday As DayOfWeek = startdate.Value.Date.AddDays(i).DayOfWeek
If Weekday = DayOfWeek.Saturday Then
countsat += 1
End If
If Weekday = DayOfWeek.Sunday Then
countsun += 1
End If
If Weekday <> DayOfWeek.Saturday AndAlso Weekday <> DayOfWeek.Sunday Then
nonholiday += 1
End If
Next
lblSumHeadCount.Text = nonholiday & " Day(s)"
End Sub
'Thanks Gabe