Hello, I have a script that needs to only carry out and action if the day is not a weekend. Could somebody assist with this code?
Code:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'convert date1 to a string Dim StartDate As Date = DateTimePicker1.Value Dim StartDateStr As String 'get date2 Dim EndDate As Date = DateTimePicker2.Value 'get the number of days between date1 and date2 Dim intDays As Integer = EndDate.Subtract(StartDate).Days() Dim i As Integer For i = 0 To intDays 'Check If StartDate is a not a weekend 'if it is not a weekend 'Do code Else EndIf StartDate = StartDate.Date.AddDays(1D) Next End Sub




Reply With Quote