fytgd fasdsdfa
fytgd fasdsdfa

Reputation: 13

How to mark all dates in month calendar

I know how to mark just one date like

monthCalendar1.BoldedDates = qwerDates;

but does any one know how to Bold all dates for example, I want to Bold January 1, what I mean January 1 is all the January 1's in all years from this current year until year 9999

Upvotes: 1

Views: 156

Answers (1)

Grant Winney
Grant Winney

Reputation: 66509

You could use LINQ to create an array of DateTime objects, like this one that creates an instance for January 1st of each year from the current year to 9999.

var now = DateTime.Now.Year;

monthCalendar1.BoldedDates =
    Enumerable.Range(now, 10000 - now).Select(x => new DateTime(x, 1, 1)).ToArray();

Upvotes: 1

Related Questions