Friday, September 19, 2014

Using a DateTimePicker in a BindingNavigators ToolStrip, or any other ToolStrip I assume

There is a dropdown menu in the binding navigator toolstrip (Windows Forms) where you can insert various controls. The DateTimePicker is not one of them though but that can be easily circumvented. All you need to do is to add something like the following in your form constructor/initializer and you have a picker right where you want it.

var picker = new DateTimePicker();
var host = new ToolStripControlHost(picker);
bindingNavigator.Items.Add(host);

No comments: