User281315223 posted
You could take a very basic approach and simply iterate through the days until you reach the next Wednesday (or any other specified day you are looking for) :
Public Function GetNextDayOfType(ByVal currentDate As DateTime, ByRef dayOfWeek As DayOfWeek) As DateTime
' Store a reference for the current date '
Dim resultDate = currentDate
' Begin iterating until you get to the appropriate day of the week '
While resultDate.DayOfWeek <> dayOfWeek
' Increment the day '
resultDate = resultDate.AddDays(1)
End While
' We hit the day we are looking for, output it '
Return resultDate
End Function
You could use this as :
' Find the next Wednesday from Today '
Dim nextWednesday = GetNextDayOfType(DateTime.Now, DayOfWeek.Wednesday)
You can see a working example here.