DataTimePicker display only the time

4

I'm developing an application for receiving my work in C # . Since I'm still crawling in the language, I need your help. The calendar will contain the following fields:

  • Name of the applicant; Scheduling Date (I am using the DataTimePicker);
  • Start time (I'm using DataTimePicker);
  • End time (I'm using DataTimePicker);

In the Start Time and End Time, I changed the Format to Time, but when I click, the complete date continues to appear. How would I configure these fields to only show the time for the user to select?

Follow below as it appears to me. I need you to show up 00:00:00 until 23:59:59:

    
asked by anonymous 07.08.2015 / 15:56

2 answers

0

I have. As MyChapter's tip in creating a Combox, I put it like this:

public Form1()
        {
            InitializeComponent();
            DateTime time = DateTime.Today;
            for (DateTime _time = time.AddHours(08); _time < time.AddHours(18); _time = _time.AddMinutes(30)) //from 16h to 18h hours
            {
                comboBox1.Items.Add(_time.ToShortTimeString());
            }
        }

 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string strTime_Start = comboBox1.SelectedItem.ToString();
            string strTime_End = "18:00";
            DateTime dateTime_Start = Convert.ToDateTime(strTime_Start);
            DateTime dateTime_End = Convert.ToDateTime(strTime_End);
        }

The result is as below:

    
07.08.2015 / 16:43
0

According to documentation in addition to changing the format for Time you must also "set" with true the ShowUpDown property

timePicker = new DateTimePicker();
timePicker.Format = DateTimePickerFormat.Time;
timePicker.ShowUpDown = true;
    
07.08.2015 / 16:07