473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Edits on DataRow not visible

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
2 1566
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jim Heavey | last post by:
Hello, I have a datagrid that I have configured to bind to "table1". I created and "EditItemTemplate" which is also bound to "table1" except for two columns which I bound to "table2" and "table3"...
4
by: CaptRR | last post by:
I think this is the right group to post to, so here goes. My problem is this, I cannot update the datarow to save my life. Been on this for 2 days now, and still am no closer to figuring it out...
1
by: guoqi zheng | last post by:
Dear sir, I have a textbox inside a repeart control, autopostback set to true for that textbox. When the value of this textbox changes, I need to access current row and update database. ...
9
by: Marc R. | last post by:
Happy new year everyone, Back from vacation, and here's a new Chalenge for "moi". I got 2 Dataview. 1 for DVsupplierSearch that is bind to a grid 1 for DVSupplierDetails, that is bind to...
3
by: Crazy Cat | last post by:
Using Visual Basic 2005 how do I cancel edits on a databound control. I want the user to be able to cancel all edits on a form. My main databound control is a DataGridView which is bound to a...
4
by: Keith G | last post by:
VS2003 I am using a datagrid on a Windows form. The user has 2 buttons: cancel the current changes (re-loads the dataset) or update (updates the dataset). The problem is that any edits in the...
2
by: DBC User | last post by:
I would like to know how to set a focus to a datarow? (using datarow.selected=true, select the row but does not show the row on the screen visible if it is below/above the grid display area).
8
by: BASSPU03 | last post by:
I'm using Access 2003 on a Windows XP O/S. I've made two copies of Form1 so that there're are 3 forms: 1) Form1 2) Form2 3) Form3 Essentially, they all write to the same Table1.
0
by: Susan Bricker | last post by:
Hi. I have a form that is open with AllowAdditions and AllowEdits both set to False. I don't want to allow edits on this screen at this point in the "flow". Opening up a second form seems to be...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.