With DateTime.Get DayOfTheMonth(Ticks As Long) you get the day of the month. The argument must be ticks.
But if you want to filter on Monday I think you should look for DateTime.GetDayOfWeek(Ticks As Long). The result is a number (1 = sunday). You could use an array for the day names.
If DateTime.GetDayOfWeek(DateTime.Now) = 1 Then
Lab_lat.text= "Sunday"
Else
If DateTime.GetDayOfWeek(DateTime.Now) = 2 Then
Lab_lat.text= "Monday"
Else
If DateTime.GetDayOfWeek(DateTime.Now) = 3 Then
Lab_lat.text= "Tuesday"
Else
If DateTime.GetDayOfWeek(DateTime.Now) = 4 Then
Lab_lat.text= "Wednesday"
Else
If DateTime.GetDayOfWeek(DateTime.Now) = 5 Then
Lab_lat.text= "Thursday"
Else
If DateTime.GetDayOfWeek(DateTime.Now) = 6 Then
Lab_lat.text= "Friday"
Else
If DateTime.GetDayOfWeek(DateTime.Now) = 7 Then
Lab_lat.text= "Saturday"
Else
End If
End If
End If
End If
End If
End If
End If
Sub Button1_Click
Dim WeekDaysStr() As String
WeekDaysStr = Array As String ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
Label4.Text=WeekDaysStr(DateTime.GetDayOfWeek(DateTime.Now) + 1)
End Sub
The GetDayOfWeek function returns a number between 1 and 7.
But the array begins with index 0 so the last index is 6 and you get the error when GetDayOfWeek = 7.
So you must substract 1 and not add one.