nullable date time picker
-
hi, i have this problem , m using binding source to Bind the controls in windows form , but if i had a nullable field of type date in the database i cant bind it to the datetime picker,and i don't want to use masked textbox or textbox,here is my code Mydatetiempicker.dataBinding.add(new Binding("Value",SomeBindingSource,"DBField")) is there any way to have null value in the date time picker? or is there any control to use in this case better than datetimepicker? thx
-
hi, i have this problem , m using binding source to Bind the controls in windows form , but if i had a nullable field of type date in the database i cant bind it to the datetime picker,and i don't want to use masked textbox or textbox,here is my code Mydatetiempicker.dataBinding.add(new Binding("Value",SomeBindingSource,"DBField")) is there any way to have null value in the date time picker? or is there any control to use in this case better than datetimepicker? thx
1. Bind your datetimepicker.text, not datetimepicker.value 2. Add this code in datetimepicker_Validating(object sender, CancelEventArgs e) event: if (!datetimepicker.Checked) ((Order)orderBindingSource.Current).OrderDate= null; So, you need to manually set your Date to null value I hope it helps!
-
hi, i have this problem , m using binding source to Bind the controls in windows form , but if i had a nullable field of type date in the database i cant bind it to the datetime picker,and i don't want to use masked textbox or textbox,here is my code Mydatetiempicker.dataBinding.add(new Binding("Value",SomeBindingSource,"DBField")) is there any way to have null value in the date time picker? or is there any control to use in this case better than datetimepicker? thx