Or you could make a simple decision in which you have one choice of time, which selects a date, and next to it is a ComboBox, which has a time of 00.00, 00.30 ... 23.00, 23.30. I am considering a solution in which the date picker will have the exact function you are looking for. Will edit this post if I find anything better.
EDIT:
You do not know which versions of .net have the NumericUpDown component, but if you have this, you can use this event with a modified value. Here is a sample code:
decimal previousValue = 0; DateTime time = new DateTime(2000, 6, 10, 0, 0, 0); bool justChanged = false; private void numericUpDown1_ValueChanged(object sender, EventArgs e) { if (justChanged) { justChanged = !justChanged; return; } else justChanged = !justChanged; if (numericUpDown1.Value < previousValue) time = time.AddMinutes(-30); else time = time.AddMinutes(30); numericUpDown1.Value = decimal.Parse(time.ToString("HH,mm")); previousValue = numericUpDown1.Value; }
Flipbed
source share