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.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,504 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,032 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,651 questions
C#
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.
10,830 questions
C++
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.
3,685 questions
{count} votes

Accepted answer
  1. Viorel 116.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 Answers by the question author, which helps users to know the answer solved the author's problem.