Count Saturday, Sunday, Holiday and Non-Holiday
Count Saturday, Sunday, Holiday and Non-Holiday
I want to find total of Saturday, Sunday, Holiday & Non-holiday from start day to end day. When I run this code an error show. Pls give me solution. below my code.
Public Class Form1
Private Sub DateEdit2_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateEdit2.EditValueChanged
Try
Dim countsun As Integer = 0
Dim countsat As Integer = 0
Dim NonHoliday As Integer
Dim TotalDay = (DateEdit2.DateTime.Date - DateEdit1.DateTime.Date).Days
For i = 0 To TotalDay
Dim Weekday As DayOfWeek = DateEdit1.DateTime.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
LblSaturday.Text = countsat & " Day(s)"
LblSunday.Text = countsun & " Day(s)"
LblHoliday.Text = countsat + countsun & " Day(s)"
LblNonHoliday.Text = NonHoliday & " Day(s)"
Catch ex As Exception
End Try
End Sub
error is : Could not resolve this reference. Could not locate the assembly "DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
– rkdev
Aug 28 at 9:24
This error has nothing to do with this code. You haven't added a reference to DevExpress component mentioned in the error message. You should search how to add components to a VB project msdn.microsoft.com/en-us/library/wkze6zky.aspx
– Steve
Aug 28 at 9:26
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Any chance to get the error message and the line where this occurs?
– Steve
Aug 28 at 9:18