DataGrdView Databinding Textbox (forced to tab away)

DataGrdView Databinding Textbox (forced to tab away)

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


cmay posted on Tuesday, August 01, 2006

I am binding a DataGridView => BindingSource => Businesslistbase.

Pretty much everything work ok, except 2 things I am wondering if I can change.

1) When modifying a textbox in the grid, you have to either click on another row or hit the enter key for those changes to make it back to my list object.  So if you edit a textbox and click the Save button, it will actually not save what you have typed (because you didn't hit enter).

Is there a way to do this so that you don't have to hit enter?

2) I am using the BindingNavigator for the Add, Delete, and Save buttons. Add and Delete do what you would expect w/o any code by me.  But, "Save" doesn't really do anything.  I can easily get around it by catching the save click event and manually saving, but I am wondering if I did something wrong that the Save button doesn't automaticlly cause my BusinessListBase to save?

 

 

Brian Criswell replied on Tuesday, August 01, 2006

1) Call EndEdit on the BindingSource.  This should force the last databinding to occur without the need to tab or click away.

cmay replied on Tuesday, August 01, 2006

Brian,

Thanks, I will give that a try.

I guess if I ever get (2) working, I guess it will either automatically cal EndEdit ( I hope ).

cmay replied on Tuesday, August 01, 2006

I found that calling EndEdit on the datasource didn't help.  I had to call it directly on the datagrid like this:

Me.MyDataGridView.EndEdit()

 

Copyright (c) Marimer LLC