DateTimePicker Default value: How to avoid it?
c#, datetimepicker
Solution
My ugly workaround to this issue, consists on set active the tab in which the DTP's reside before changing its values, something like this:
DateTime dat1 = DateTime.Today;
DateTime dat2 = dat1.AddDays(1).AddSeconds(-1);
dtpCreatedStart.Value = dat1;
dtpCreatedEnd.Value = dat2;
tbc.SelectTab(1);
dtpModifiedStart.Value = dat1;
dtpModifiedEnd.Value = dat2;
tbc.SelectTab(0);
Problem
Facts: - I have a TabControl with 2 Tabs, Each tab has 2 DateTimePicker. - In the Load event, I set the value of all the DTPs. - All DTPs have ShowCheckBoxes set on true AND Checked set on false. - When I Execute the program, The DTPs in first tab are OK, but when I check the DTPs on second tab, they show current time, not the time I set on the load event. Why this happen? How can I avoid it?