As I see it there are three ways of achieving this.
1. Write your own TimePicker control where you dictate what can be changed. This is the hardest solution but the most complete as you get complete control of the changes.
2. Inherit
DateTimePicker
and override
OnValueChanged
in such a way that all changes that change something other that the minute are rejected.
Such an implementation might look something like this:
Public Class MyPicker
Inherits DateTimePicker
Private previous As DateTime
Public Sub New()
previous = Value
End Sub
Protected Overrides Sub OnValueChanged(eventargs As System.EventArgs)
If previous.Minute = Value.Minute Then Value = previous
previous = Value
End Sub
End Class
3. Wire up the events on a normal
DateTimePicker
instance to do the logic described in solution 2.
That might look something like this:
Public Class Form1
Private previous As DateTime
Public Sub New()
InitializeComponent()
previous = DateTimePicker1.Value
End Sub
Private Sub DateTimePicker1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles DateTimePicker1.ValueChanged
If previous.Minute = DateTimePicker1.Value.Minute Then DateTimePicker1.Value = previous
previous = DateTimePicker1.Value
End Sub
End Class
Note that solution 2 and 3 still allows the user to select other fields, it's jut that they are never allowed to be changed. This might feel un-intuitive to the user so I recommend going for solution 1.
Hope this helps,
Fredrik