Click here to Skip to main content
14,736,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

Is there any way to get the datagridview cell value when changing?

I have a datagridview with 5 columns such as Invoice number, Invoice Date, Invoice For, Qty, Rate, Unit Price.

When i changing the qty or rate, application needs to multiplies the qty and rate and put it them into Unit Price cell.

I have already tried with CellValueChanged with CurrentCellDirtyStateChanged. But it end edit the cell value of my current editing cell's data. which cause that unable to enter further data into that cell.

http://stackoverflow.com/questions/3820672/cell-value-changing-event-c


Please help me to solve this.
Posted
Updated 20-Mar-15 21:25pm
v2
Comments
ChrisCreateBoss 21-Mar-15 12:56pm
   
Did you check this too? : https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellvaluechanged(v=vs.110).aspx
Sinisa Hajnal 21-Mar-15 16:51pm
   
I agree with Chris, you should use Changing event for canceling the change and validation, not for getting the value to work with.

You could probably get the value by using e.FormattedValue (or is it dgv.rows(e.rowIndex).Cell(e.columnIndex).FormattedValue?)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900