473,387 Members | 1,844 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,387 software developers and data experts.

What happens on DataRow.EndEdit

Hi All

I have a bit of a problem with using a datarow to store data that is show in
a form.
On form load I set the Value/Text properties of my form elements to the
specific Column values of the DataRow which works just fine.
On form close I assign the specific DataRow Column values to the value of
the form elements, to update the datarow to the newest values.
The problem is that even if I make no changes to the form the DataRow is
changed afterwards no matter what.

The ColumnChanging event is not raised on my datatable, but as soon as I
call the EndEdit method on the datarow, the RowChanged event is raised on
the DataTable.
Even if I make no assignments to the Row values on form close, the
RowChanged event is raised anyhow.

Is this a normal behavior of the datatable to always see the row as changed
if EndEdit is called ??
I'm a bit confused.
Tanks in advance
Allan
Jul 21 '05 #1
3 6953
Hi Allan,

Yes, calling EndEdit (after BeginEdit) will set row state as changed and
invoke RowChanged/ing events.
You might consider using CancelEdit or not to use Begin/End/Cancel edit
mechanism though.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Allan Bredahl" <a@bredahl.org> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi All

I have a bit of a problem with using a datarow to store data that is show in a form.
On form load I set the Value/Text properties of my form elements to the
specific Column values of the DataRow which works just fine.
On form close I assign the specific DataRow Column values to the value of
the form elements, to update the datarow to the newest values.
The problem is that even if I make no changes to the form the DataRow is
changed afterwards no matter what.

The ColumnChanging event is not raised on my datatable, but as soon as I
call the EndEdit method on the datarow, the RowChanged event is raised on
the DataTable.
Even if I make no assignments to the Row values on form close, the
RowChanged event is raised anyhow.

Is this a normal behavior of the datatable to always see the row as changed if EndEdit is called ??
I'm a bit confused.
Tanks in advance
Allan

Jul 21 '05 #2
Thanks a lot for the answer...
Isn't that behavior quite odd ?

I consider the DataRow as changed when its content has changed, not when I
stop editing it.
Hmm, that means that I have to do a manual comparison on all my DataRow
columns and only call EndEdit if anything is changed.

That seams a bit stupid to me :-)

thanks

Allan
"Miha Markic" <miha at rthand com> skrev i en meddelelse
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Hi Allan,

Yes, calling EndEdit (after BeginEdit) will set row state as changed and
invoke RowChanged/ing events.
You might consider using CancelEdit or not to use Begin/End/Cancel edit
mechanism though.

Jul 21 '05 #3
Isn't that behavior quite odd ?

I consider the DataRow as changed when its content has changed, not when I
stop editing it.
Hmm, that means that I have to do a manual comparison on all my DataRow
columns and only call EndEdit if anything is changed.

That seams a bit stupid to me :-)


Yes, it might be better :)

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jon S via DotNetMonster.com | last post by:
Hi all, I'm having a problem updating a simple change I've made to a Access 2000 table through databinding. The error I get is : An unhandled exception of type...
1
by: Shock | last post by:
Anybody ever tried to assign certain values in one datarow to certain locations in another datarow? Here is my code to this pont. Followed by the output from the command window in vs.net...
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...
2
by: Steve Amey | last post by:
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...
6
by: timbobd | last post by:
I have a Windows form that displays a database table in a DataGrid. When you click on a row, the row's values get copied to bound TextBoxes below, and when the "Save" button is clicked the database...
3
by: Allan Bredahl | last post by:
Hi All I have a bit of a problem with using a datarow to store data that is show in a form. On form load I set the Value/Text properties of my form elements to the specific Column values of...
3
by: phonl | last post by:
VB.NET 2005 and ADO2.NET After years of VB6 and ADO coding, I'm checking out ADO2.NET. I spent several hours trying to figure out why the line: objDataAdapter.Update(objDataSet, "myTable") ...
1
by: Marc | last post by:
I found this in MSDN: "The BeginEdit method is called implicitly when the user changes the value of a data-bound control; the EndEdit method is called implicitly when you invoke the...
3
by: joelzn | last post by:
I have a hand built dataset where some columns come from a sql database and others are calculated and eventually I will have two different query results going into one table because its impossible...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.