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

Home Posts Topics Members FAQ

changes in table <--> DataGrid

Hello,

I have a DataGrid(View) and a DataTable. The DataTable is displayed in the
DataGridView. The user is allowed to select some rows and then the following
snippet updates some values in the selected rows:

foreach (DataGridViewRo w row in dataGridView.Se lectedRows)
{
row.Cells["theColumnName1 "].Value = someCalculatedV alue1;
row.Cells["theColumnName2 "].Value = someCalculatedV alue2;
}

Later, the changed rows in the DataTable are supposed to be recovered by
GetChanges(). But, the last selected row never is included in the rows
returned by GetChanges(). However the last selected row in the DataGridView
has visibly been changed by the mentioned foreach loop.

I think this last row is not changed in the DataTable because the changes in
a DataGridViewRow are never 'committed' in some way before changes to another
DataGridViewRow are made.

I tried a few things (like selecting other another row after the foreach
loop, hoping this would 'commit' the changes in the last selected
DataGridViewRow ), but nothing helped. Anyone got a clue? It seems to me this
should be pretty straightforward ...

Thanks a lot!
Nov 16 '05 #1
0 1281

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

Similar topics

1
3512
by: Soul | last post by:
Hi, I have a DataGrid which works. But if I load a new table to the DataGrid, it will still show those old data I load earlier. private void loadTableA() { if ( openFileDialog.ShowDialog() == DialogResult.OK ) { this.dataGrid.SetDataBinding(null, null);
0
1183
by: lanky_tx | last post by:
Hello, I am trying to hide a column in a child table within a windows form DataGrid control. I am populating the Datagrid datasource with an dataset which is populated with hierarchical XML only 2 levels deep. XML: <Customers id="123" name="Joe" level="A">
1
1172
by: Jim | last post by:
I have a class that inherits from the DataGrid class. I want to know when the datasource of my datagrid has changed, but want to execute a function within my extended datagrid class. For example: If you drag out a datagrid onto a form, you can assign an event handler to "DataSourceChanged" event of the datagrid. I wish to execute code within the extended datagrid class every time the data source changes. Anyone know how to do this?
6
1843
by: Khumar | last post by:
Hello, Im new in asp.net especially in web base application. I want to ask about datagrid. I had shown my table on datagrid, and what I want to ask is how to set the column height fixed? Because when I have a long word it automatically set new line instead of hide it. I want it to be hide like this 928192... with 3 dot at the end of the word if it is to long.
0
827
by: JIM.H. | last post by:
Hello, I have a datagrid object in my web page and when I click a button, datagrid shows the data received from database. Number of columns is defined by the sql string string I gave. Now I need to give add/edit/delete features for each row in the datagrid. How should I do this? I am using vb code. Thanks Jim,
0
1514
by: latin & geek via DotNetMonster.com | last post by:
hi! ok, im working on a database application. ive successfully managed to establish a relationship between two tables and display them on a datagrid, edit and add new records to them. now i need to generate a report using the parameters in the child table, and two columns from the parent table. this is where the problem starts. when i use two seperate connection links and extract the required data, adding it all to the same dataset,...
6
3522
by: Bill nguyen | last post by:
I use DatagridTableStyle to display data from table WF_Carrier_FreightChart. USers than can add/delete/edit rows in the Datagrid. Since the Datagrid's datasource "dCarrierFreight" is just a copy/view of the table (dataset dFreight.tables(0) ), I need to update the original table to reflect multiple changes in the Datagrid. Your help is greatly appreciated. Bill
1
1101
by: khalid sohail | last post by:
hi everybody, can anyone one help me how i can display colunm from other table in the datagrid actually i want to display the department name on the basis of department id in the employee table....hope i have well explained my question... thanx in advance
5
2954
by: yzlin04 | last post by:
I'm using VB.net 2003. I can delete a row in datagrid (dgTempTransaction), but my MS Access table can't directly being updated. The row i deleted is still exist in my MS Access, but in my datagrid, it already being deleted. The table name in my MS Access: tableTempTransaction. Here is my code for that part...i don't know where is the error. Please help me..... Thanks anyway. Dim currManager As CurrencyManager If...
1
1396
by: visweswaran2830 | last post by:
Hi, I am having datagrid in that I have one column that should have table. Now I want to know that how can I include table in datagrid. My table values may differ from each rows in datagrid. So that also should be accomplished.
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,...
0
10383
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10178
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10128
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
9000
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7521
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
6751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
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
4080
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

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.