You can, but (no offense) that's a bit more complicated than I feel you're used to. And doing it the no-loop-boring-type-it-all way would be faster anyway.
However, if you want to try it, you have to store Worktime_dtpicker_startDay1, Worktime_dtpicker_startDay2, ..., WorkTime_dtpicker_startDay7 in a list:
List<datetimepicker> startPickers = new List<datetimepicker>()
{
Worktime_dtpicker_startDay1, Worktime_dtpicker_startDay2,
Worktime_dtpicker_startDay3, Worktime_dtpicker_startDay4,
Worktime_dtpicker_startDay5, Worktime_dtpicker_startDay6,
Worktime_dtpicker_startDay7
}
Same for the
end time pickers. And again the same for the
break UpDowns. And for the
result labels.
Then, you can
for(int i = 0; i < 7; i++)
{
int minutes = (int)((endPickers[i] - startPickers[i]).TotalMinutes);
minutes -= breakUpDowns[i].Value;
resultLabels[i].Value = minuts.ToString();
}
---------------------------------------------------------------
Level 2:
Totally not what you were asking, but read up on
UserControls and create one that includes pickers and label. Then use 7 of them instead of all the individual controls. Calculate result within the usercontrol on every input change. No need for a loop at all, but gives a very responsive UI.