473,324 Members | 2,178 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,324 software developers and data experts.

DataGridView Edited Row

How can i tell if a row in my DataGridView has been edited? I'm loading a
DataTable with ID3 information from MP3 files and using that as the
datasource for the DataGridView. I'm letting the user edit the information
in the grid and when the user has finished, he clicks the "Update" button.
Then I update the ID3 information in each MP3 file with the data from the
grid. However, if the grid has hundreds of files in it, this can take a
while.

I'd like to only update a file if its information has been edited. I didn't
find a property like "IsRowDirty" for the grid.

Thanks for any help.
Feb 19 '07 #1
4 15435
One way you can get the changed information is to directly use the
datatable by calling DataTable.GetChanges. This will give you a
datatable that holds the changed rows. (Depending upon how you are
initially loading the Datatable, you may need to call
DataTable.AcceptChanges right after the table is initially loaded so
GetChanges will only return your user changes, and not the changes
that came about as a result of the initial load.)

===================
Clay Burch
Syncfusion, Inc.

Feb 19 '07 #2
"Terry Olsen" <to******@hotmail.comwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
How can i tell if a row in my DataGridView has been edited? I'm loading a
DataTable with ID3 information from MP3 files and using that as the
datasource for the DataGridView. I'm letting the user edit the information
in the grid and when the user has finished, he clicks the "Update" button.
Then I update the ID3 information in each MP3 file with the data from the
grid. However, if the grid has hundreds of files in it, this can take a
while.

I'd like to only update a file if its information has been edited. I
didn't find a property like "IsRowDirty" for the grid.

Thanks for any help.
Is there a Changed or TextChanged event for the DataGridView?
A method I used in a project could be adapted here, you add a 0 width column
to the DataGridView when you create it.
If the row is changed, set it to have a value, then later on when you save,
hack through the DataGridView.
If the flag column has a value, save it; if not, don't.
Another approach would be to store the original value in the flag column
when you populate the DataGridView.
Check that the 2 are the same when you go to save, if not, it's changed...
It would be harder in this case, as you're comparing several bits of
information for a change, but we can work round this.
If you have Column1, Column2 & Column3, Flag could contain
Column1|Column2|Column3, and we can play like that.
It would help, of course, if the delimiter is something that is illegal in
IDv3.

Hope some (or even better, all) of this helped.

--Paul Evans
SHL Computing

Feb 19 '07 #3
Terry,

Strange because this is lucky enough the only "Dirty" property at Net.

http://msdn2.microsoft.com/en-us/lib...trowdirty.aspx

Cor

"Terry Olsen" <to******@hotmail.comschreef in bericht
news:ex**************@TK2MSFTNGP02.phx.gbl...
How can i tell if a row in my DataGridView has been edited? I'm loading a
DataTable with ID3 information from MP3 files and using that as the
datasource for the DataGridView. I'm letting the user edit the information
in the grid and when the user has finished, he clicks the "Update" button.
Then I update the ID3 information in each MP3 file with the data from the
grid. However, if the grid has hundreds of files in it, this can take a
while.

I'd like to only update a file if its information has been edited. I
didn't find a property like "IsRowDirty" for the grid.

Thanks for any help.

Feb 19 '07 #4
There is an underlying property on each row of the DataTable that tells you
if the record has been added, modified, or deleted. It stays active until
you push the changes down to your data source.

How are you doing your update? If you are calling the Update method on a
tableadapter or SqlAdapter, it only updates the rows that have been
modified.

Robin S.
----------
"Terry Olsen" <to******@hotmail.comwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
How can i tell if a row in my DataGridView has been edited? I'm loading a
DataTable with ID3 information from MP3 files and using that as the
datasource for the DataGridView. I'm letting the user edit the
information in the grid and when the user has finished, he clicks the
"Update" button. Then I update the ID3 information in each MP3 file with
the data from the grid. However, if the grid has hundreds of files in it,
this can take a while.

I'd like to only update a file if its information has been edited. I
didn't find a property like "IsRowDirty" for the grid.

Thanks for any help.

Feb 19 '07 #5

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

Similar topics

1
by: Arvind | last post by:
Hi I edit a cell in a DataGridView, and then would move to another cell in the DataGridView using mouse. Then the DataGridView as of now does scroll down to the last visited cell. But when I try...
0
by: RSH | last post by:
I am working with the DataGridView control in a WinForm. I have written the code to change the background color of a cell after it is edited. I also change the color of the row (a different...
2
by: bob | last post by:
Can anyone tell me the best way to update a dataset while it is being edited/viewed in the DataGridView control? Is this something that should be inserted into one of the grid's events? or should...
0
by: MKBender | last post by:
Hello everyone, What I'm currently trying to do is allow a user to add a row to my datagridview. I have AllowUserToAddRows set to true. And the empty now does appear at the bottom of my data. ...
5
by: DanThMan | last post by:
The situation: * I have a ButtonColumn in a DataGridView. * When the user preses one of the buttons, a dialog appears. * Based on what the user selects in the dialog, data is entered...
1
by: kristian | last post by:
Hi all I have a simple form with not much more than a datagridview control, and want to show and edit the contents of a table in my mysql table. So far I have managed to set the db table as a...
0
by: RickH | last post by:
Has anyone tried wrapping the DataGridView control itself as a custom Cell/Column control. So that I can have a child DataGridView appear in a column of a parent DataGridView so that the...
0
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
I edit a cell in a DataGridView, and then would move to another cell in the DataGridView using mouse. Then the DataGridView as of now does scroll down to the last visited cell. But when I try to...
12
by: cj | last post by:
When viewing a datatable in a datagridview one of the columns in it is a "note" field which can be quite long. I would like to have the note field of the currently selected row of the datagrid...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
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...
1
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: 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.