Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

DateTimePicker to textbox with bindingsource doesn't update

$
0
0

Can someone help me with reference to programmatically entering a value into a textbox and pushing it through to the underlying datasource?

To start off, I want the user to enter a valid date into a textbox, plus I want null dates. Simple request but it's hard.

If the project is not completed there is no date, if it's completed the user fills in a valid date the project was completed, not rocket science.

I have a form with a LINQ query taking data from my sql database. The data is then bound to my controls. All my fields update ok except I'm not happy with the COMPLETE DATE field.

I tried using a datetimepicker, but sadly it doesn't accept null dates. Then I tried using a maskedtextbox to help validated a correct date, sql screamed at the format before and after binding.

Lastly, I used a datetimepicker result into textbox through a function but this is when the fun begins. On selection the date is put into the textbox, but as soon as I tab to another field, the date reverts back to a date that I originally queried before change. I've tried using every Bindingsource command there is, endedit etc.

Does anyone have a solution to this problem?

Thanks

Mark


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>