BindingSourceRefresh and DateTimePicker control

BindingSourceRefresh and DateTimePicker control

Old forum URL: forums.lhotka.net/forums/t/400.aspx


brettswift posted on Sunday, June 18, 2006

In reading the book I see that the BindingSourceRefresh control needs to be on the form for some quirky databinding scenarios.  I have done this, and I have set the ReadValuesOnChange even to true in teh binding sources. 

However....    this still doesn't work with the datetime picker -  The date loads up ok, but the datetimepicker control, when I select a new date, won't update the datasource.

I've tried to find out what my problem is using the book but I still can't find it.. Anyone have any ideas? 

brettswift replied on Monday, June 19, 2006

Anyone?

JWoods replied on Monday, June 19, 2006

I also tried BindingSourceRefresh on a form with a datagridview where the last row that I updated was not being refreshed.  This did not solve the problem  The problem was solved by a call to BindingSource.ResetBindings(false).

 

JWoods

brettswift replied on Monday, June 19, 2006

I'll try that, not sure where you put that code though?

Also, my DateTimePicker isn't even being saved! ! !    The databinding is setting the value, but its not even coming out of the datetimepicker control!

Do I have to use a textbox?

JWoods replied on Monday, June 19, 2006

Maybe we have different problems.  My scenario is that I have a block of code that loops the rows in a DataSource that is bound to a DataGridView through a BindingSource.  After doing the updates, I see that the last row updated does not reflect its changes in the Grid control.  My fix was to call Me.MyBindingSource.ResetBindings(false) where the variable MyBindingSource is defined on my form and assigned as the datasource to the grid view.

Perhaps I misunderstood your problem, which is the opposite, where you are changing the data through the control but your datasource is not updated.

 

JWoods

dean replied on Monday, June 19, 2006

Brett - I know that back in .net 1.0 I could never get databinding and datatimepicker to work. I resorted to using the ValueChanged datetimepicker event to update my object manually.

Dean.

Copyright (c) Marimer LLC