PC Review


Reply
Thread Tools Rate Thread

DataGridView Edited Row

 
 
Terry Olsen
Guest
Posts: n/a
 
      19th Feb 2007
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.


 
Reply With Quote
 
 
 
 
Paul Evans
Guest
Posts: n/a
 
      19th Feb 2007
"Terry Olsen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

 
Reply With Quote
 
ClayB
Guest
Posts: n/a
 
      19th Feb 2007
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.

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      19th Feb 2007
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
RobinS
Guest
Posts: n/a
 
      19th Feb 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to know which row is edited in DatagridView fiaolle Microsoft C# .NET 0 7th Jul 2009 12:12 PM
How do convince a DataGridView it's been edited? DanThMan Microsoft C# .NET 5 26th Jan 2007 04:41 PM
How do convince a DataGridView it's been edited? DanThMan Microsoft Dot NET 5 26th Jan 2007 04:41 PM
Re: How do convince a DataGridView it's been edited? DanThMan Microsoft VB .NET 3 26th Jan 2007 04:41 PM
DataGridView - Determine if a row has been edited =?Utf-8?B?UCBL?= Microsoft ASP .NET 1 20th Apr 2006 06:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:47 AM.