How to change back color of UserControl that equal date today.

Anonymous
2023-05-03T05:24:40.0166667+00:00

User's image

Good day, I created a calendar but I don't know how to change the back color of User Control which equal to day today.

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
SQL Server | Other
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Viorel 125.6K Reputation points
    2023-05-03T05:40:04.2933333+00:00

    For example, try adding this line inside the second loop:

    if( i == now.Day ) ucdays.BackColor = Color.Red;
    

    You can also add a bool or DateTime parameter to the days function, and adjust all of appearance inside the function.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.