By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

Edits on DataRow not visible

P: n/a
Hi all

I am binding a DataRow to some controls on a form. When I've finished
editing the DataRow I click on a toolbar button to save the changes. If the
focus is on a particular control, the item in the DataRow does not update to
be the value of the control, for example, if I have a TextBox called
txtEntry which is bound to the Entry column of the DataRow, if the focus
remains on the TextBox while I click on the save button the DataRow("Entry")
is DBNull.

When the control loses focus, the DataRow is updated with the correct value,
so I'm left with a scenario when the users have to shift focus off the last
control before saving the data, which is obviously not a good thing. I have
tried calling the DataRow.EndEdit before the save but it still didn't update
with the correct value.

Has anyone else come across this behaviour? How do I deal with updating the
DataRow when the bound control does not lose focus before the save is made?

Kind Regards,
Steve.
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Steve,

This question is absolute in the top hundred of the most asked/answered
questions.

Use endcurrentedit to push the data to the underlaying datasource.

Something as
BindingContext(ds.Tables(0)).EndCurrentEdit()

I hope this helps a little bit?

Cor
Nov 21 '05 #2

P: n/a
Hi Cor

Thank you for your response.

I have seen this before, but what made my situation slightly different is
that I do not have a DataTable, I just have a DataRow. I tried creating a
Currency Manager object by doing Dim oCM As CurrencyManager =
BindingContext(m_oRow), but was getting an invalid cast exception, however,
if I use your code snippett below and just change it to
BindingContext(m_oRow).EndCurrentEdit(), it works fine.

Cheers.
Steve.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:ef**************@TK2MSFTNGP10.phx.gbl...
Steve,

This question is absolute in the top hundred of the most asked/answered
questions.

Use endcurrentedit to push the data to the underlaying datasource.

Something as
BindingContext(ds.Tables(0)).EndCurrentEdit()

I hope this helps a little bit?

Cor

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.