Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Update changes in a cell of a DataGridView to datatable without move to next cell
 

Update changes in a cell of a DataGridView to datatable without move to next cell

I am using a binded dgv with datatable my problem is how i can update the changes in a cell of a dgv to datatablewithout move to next cell

my dgv's allow addnew property is false because of that if user is in last row he cannot go to next row after changes, without go to next row dgv data does not updating the datatable.

Thanks in Advance

backer  Tuesday, October 23, 2007 7:00 AM

I don't want to update to database.......... i want to update to datatable, at last i found the answer from another guy ie,

the dgv will update the table only on validte if u want to update without move to next cell or next row u just validate dgv for validate we can use the foll. code

Code Block
me.validate

backer  Sunday, October 28, 2007 11:39 AM

Hi, backer,

Based on my understanding, you want to update your DataBase from your DataGridView without going to the next cell, don't you?

I guess you are updating you DataBase in RowValidated event, don't you?

You should just put it to CellValidated event

Code Block

private void dataGridView1_CellValidated(object sender, DataGridViewCellEventArgs e)

{

adapter.Update(datatable);

}

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview.cellvalidated.aspx

Hope this helps,

Regards

Yu Guo â€?MSFT  Friday, October 26, 2007 8:09 AM

I don't want to update to database.......... i want to update to datatable, at last i found the answer from another guy ie,

the dgv will update the table only on validte if u want to update without move to next cell or next row u just validate dgv for validate we can use the foll. code

Code Block
me.validate

backer  Sunday, October 28, 2007 11:39 AM

You can use google to search for other answers

Custom Search

More Threads

• change row in updataedrows datatable before final update
• On-demand parent-child relationship with BindingSources.
• All I need code example to access DataTable in a dataset. Plz help
• more on binding name/value
• [Answered] getting data from a datagridview cell
• Dataview RowAdded event
• Datagridview and Textbox
• scrolling a DataGridView programatically
• Setting a value of a combobox that is bound using a datarelation
• How to split the column Heading of Datagrid in Two rows