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.

Technologies de développement | Visual Studio | Autres
Technologies de développement | C#
0 commentaires Aucun commentaire
{count} votes

Réponse acceptée
  1. Alexis Thorez 11,060 Points de réputation
    2024-02-28T12:15:00.5233333+00:00

    Solution validée par @Gherca,Marius

    J'ai trouvé un moyen simple mais efficace, SendKeys("{ESC}").

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

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

Votre réponse

Les réponses peuvent être marquées comme Réponses acceptées par l’auteur de la question, ce qui permet aux utilisateurs de connaître la réponse qui a résolu le problème de l’auteur.