Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
int s1 = Convert.ToInt16(dataGridView1.CurrentRow.Cells[3].Value);

int s2 = Convert.ToInt16(dataGridView1.CurrentRow.Cells[6].Value);

int s3 = s1 * s2;

dataGridView1.CurrentRow.Cells[38].Value = s3;


this is working fine

when i change the value lively in dataGridView1.CurrentRow.Cells[3] it multiply with the changed value

with dataGridView1.CurrentRow.Cells[6] and display the value in

dataGridView1.CurrentRow.Cells[38]

like

cell[3] cell[6] cell[38]
5 5 30

pls help

thanks in advance
Posted
Updated 5-May-18 0:48am
v2

1 solution

Use DataGridView.CellValueChanged[^] event. At the end of article you'll find an example code.
 
Share this answer
 
Comments
sathish k.kumar 14-Feb-13 5:42am    
its not working. i tried your example but when ever the form loads its multiplying the values.
when the cell value is changed t time only value should get multiply otherwise remain the same
Maciej Los 14-Feb-13 5:53am    
What's not working? Improve your question and paste the part of code which not working and explain why. Describe your expectations.

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