DateTimePicker

Normando Chaile 20 Reputation points
2023-05-04T22:53:23.2433333+00:00

Hola, quería ver si me podrían ayudar a guardar la fecha seleccionada en un DateTimePicker en una variable?

Developer technologies | C#
{count} votes

Accepted answer
  1. Minxin Yu 13,506 Reputation points Microsoft External Staff
    2023-05-05T03:15:36.58+00:00

    Hi, @Normando Chaile

    You can use ValueChanged event.

            System.DateTime DT;
    
            private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
            {
               DT = dateTimePicker1.Value;
               MessageBox.Show(dateTimePicker1.Value.ToString());   
            }
    

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.