I have a 2d array and if the date selected using the dateTimePicker is a monday I want to set the row index to 1. If the date selected is a tuesday I want to set the row index to 2… I have tried do this using the code below but it doesn’t seem to work:
if (dateTimePicker.Value == DateTime.DayOfWeek.Monday)
r = 1;
if (dateTimePicker.Value == DateTime.DayOfWeek.tuesday)
r = 2;
According to Microsoft’s documentation,
DateTimePicker.Valueis of typeDateTime.Take the
DayOfWeekproperty to get the value you’re looking for.Your statement should look like: