views:

291

answers:

1

I have a datagridview with 10 columns. Every month the user will update new info in the grid. I would like to have a datetimepicker next to the binding navigator. The purpose of the datetimepicker is to scroll forward or backward month by month. If scrolling forward the datagridview creates a new datagridview with the same 10 columns populated with certain data. Then the user can just add the necessary data for the new month. if the user scrolls backward a month, the datagridview shows past gridviews and columns the user has already updated in the past. This is sort of a hybrid of a datagridview and a monthly calendar sort of thing. I've looked everywhere and cannot find any ideas on how to add this datetimepicker control with functionality. Any idea would be really helpful.

A: 

Use the OnValueChanged for the DateTimePicker to update the Filter on the BindingSource.

The DateTimePicker has an event that signifies when it's value has changed, you want to hook into that.

Once that event has fired you want to take the value of the DateTimePicker, and set the filter on the binding source to something like, "Date = '" + datePicker.toShortDateString() + "'"

This binding source should control what your datagridview displays.

Malfist