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?

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,501 questions
{count} votes

Accepted answer
  1. Minxin Yu 10,466 Reputation points Microsoft Vendor
    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