Kashif
Kashif

Reputation: 1

DataGridView Cell Value Change Not Happening

I have retrieved data from access database into a DataGridView. Let us suppose I am in Row 0. When I change the contents of Row 0, Cell 1 and press a button, the Update query should modify that row, but I am unable to modify the value of the cell. The cell maintains its previous value and the database is not modified. For example, if I change the contents of a cell from "David" to "Jhon", how can I change the value of the cell from "David" to "Jhon"? I am using VB.NET 2008.

Upvotes: 0

Views: 2477

Answers (2)

Gonzalo
Gonzalo

Reputation: 11

You most likely need to pick up the EditedFormattedValue of the cell, which has the new value. FormattedValue and Value have the original value.

Upvotes: 1

V4Vendetta
V4Vendetta

Reputation: 38210

I presume you are checking the formatted value of the cell for getting the value. Also if you are changing the values, please check if the cell value changed event is triggered or not. Coz the editing control needs to pass the changed value back to the grid cell. If you can post your code then it might be more clear and helpful.

Upvotes: 0

Related Questions