Hi Jeffrey, the DateTimePicker.ValueChanged event will not work in my
situation. I have certain edits that I need to perform when a new date is
selected. For example, one of edits is to set the
MinDate=System.DateTime.Now whenever a user selects a date. I want to apply
this edit only when the user selects a new date. However if the user is just
navigating through existing records in the datagrid, I don't want to subject
the existing dates to this restriction.
For example: MinDate=System.DateTime.Now
1. (DataGrid:Record#1) - date is 05/01/05
- if the user navigates to this row, the MinDate restriction is not
applicable.
- if the user selects a new date or modifies an existing date, then the
MinDate restriction is applicable
I am struggling to find an event that could properly handle my situation. I
had mentioned about the TextBox.Modified property because I was hoping to
find something similar in the DateTimePicker to let me know when a value has
truly been modified. Currently I am putting my edits in the
DateTimePicker.Validated event. This event works correctly for my purpose if
the user uses the mouse to select a date from the calendar. However if the
user tabs through the DateTimePicker control without making a change the
Validated event still fires causing the date value to go through the same
edits as if it was a newly selected date. I hope I was able to clearly state
my problem.
[quoted text, click to view] ""Jeffrey Tan[MSFT]"" wrote:
> Hi Lynn,
>
> Thanks for your post!!
>
> Based on my understanding, you bind DateTimePicker and DataGrid to the same
> datatable, you want to find a way to determine if the DateTimePicker's
> selected value is changed. If I misunderstand you, please feel free to tell
> me. Thanks
>
> Yes, DataGrid is doing complex databinding with the DataTable, and
> DateTimePicker is doing simple databinding with certain Column in
> DataTable. Whenever user changes row selection in DataGrid, winform
> databinding will keep the index synchronized, and the DateTimePicker's
> selected value will change with the selected row value. This by the design
> of winform databinding.
>
> For your request, I think we may hook in DateTimePicker.ValueChanged event,
> then whenever the selected value is change in DateTimePicker(whatever with
> databinding or with user modification), this event will fire, and we can
> get notification for this.
>
> Hope this helps.
> =========================================
> Thank you for your patience and cooperation. If you have any questions or
> concerns, please feel free to post it in the group. I am standing by to be
> of assistance.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! -
www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights.
>