473,789 Members | 2,194 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 15509
One way you can get the changed information is to directly use the
datatable by calling DataTable.GetCh anges. 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.Accep tChanges 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******@hotma il.comwrote in message
news:ex******** ******@TK2MSFTN GP02.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******@hotma il.comschreef in bericht
news:ex******** ******@TK2MSFTN GP02.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******@hotma il.comwrote in message
news:ex******** ******@TK2MSFTN GP02.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
5615
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 to edit the same last visited cell, focus gets shifted to the first few visible rows as per the dimensions set for the DataGridView. To be exact it goes to the cell in the first row, and the same column. If I can say it this way, I would like...
0
3325
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 color) which allows users to see what cells and which rows have been edited. The problem is that whenever the user sorts the datagidview I lose the coloration...how can I go about making sure that the cells remained colored?
2
24561
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 you update after closing the grid/form, etc.? Also, can you tell me the best book to buy that fully explains the DataGridView control? Thanks.
0
2179
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. The datagridview has a data source set to a datatable. The code currently allows a user to add the row properly and the data is making it into the datatable. So what I want to do know is auto fill in an ID column as soon as the user starts editing...
5
7153
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 programmatically into the the underlying cell (i.e., I'm setting Value property of the cell based on user input, but the user is not directly entering any data). The problem:
1
8293
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 datasource for the datagridview, and display the contents. Code bit: public partial class FormEditDbTable : Form
0
1426
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 columns/rows of the childdren can be edited like a grid on the parent rows grid. The MS examples all show how to make parent/child data grids appear in separate splitter panels. I would like it to show up kind of like how MSAccess shows data sheets in...
0
1753
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 edit the same last visited cell, focus gets shifted to the first few visible rows as per the dimensions set for the DataGridView. To be exact it goes to the cell in the first row, and the same column. If I can say it this way, I would like to see...
12
13647
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 display in a textbox below the datgridview. I currently have it fixed so if you click on a row the note field from that row is put in the textbox. I'd like this to be automatic as they move through rows. Also the note field is one of two fields...
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9502
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10131
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9973
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5407
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4081
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3681
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2899
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.