How to close the dropdown from DateTimePicker without selecting any date?

Gherca,Marius 25 Points de réputation
2024-02-27T16:20:16.2433333+00:00

How to close the dropdown from DateTimePicker without selecting any date? Visual studio, .NET, C#, WinForm. Within the code, I have to interact with the user, I'm in the DropDown event of the DateTimePicker, to my question he has to answer yes or no, if NO, I simply want the date selection menu to close. I tried another approach, with MouseDown on the DTP control but the DropDown is no longer executed, does anyone have another idea? I need the user in front of several DTPs to choose the DTP to modify, but if he chooses wrongly, to be able to switch to another one without making 1 additional click to select a date that does not needs. It's possible? THX.

Visual Studio
Visual Studio
Famille de suites Microsoft d’outils de développement intégrés pour la création d’applications pour Windows, le web et les appareils mobiles.
15 questions
C#
C#
Langage de programmation orienté objet et sécurisé au niveau des types, qui prend ses racines dans la famille des langages C et inclut la prise en charge de la programmation orientée vers les composants.
10 questions
0 commentaires Aucun commentaire
{count} votes

1 réponse supplémentaire

Trier par : Le plus utile
  1. Gherca,Marius 25 Points de réputation
    2024-02-28T09:10:19.0766667+00:00

    I found a simple but effective way, SendKeys("{ESC}").

    1 personne a trouvé cette réponse utile.
    0 commentaires Aucun commentaire