1,105,281 Community Members

multiply the two columns in datagridview

sathishk20
Newbie Poster
1 post since Feb 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

Collapse | Copy Code
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

Member Avatar
Begginnerdev
Veteran Poster
1,141 posts since Apr 2010
Reputation Points: 251 [?]
Q&As Helped to Solve: 191 [?]
Skill Endorsements: 15 [?]
 
0
 

What event are you firing the code at?

Member Avatar
castajiz_2
Posting Whiz in Training
231 posts since Apr 2012
Reputation Points: 35 [?]
Q&As Helped to Solve: 20 [?]
Skill Endorsements: 3 [?]
 
0
 

I m little bit confused. Are you trying to say that when you change the value of one cell in your case cell number 3 it is then being multyplied by the same number? Try to use

Convert.ToInt32 

You should mention what type of values are you converting and more important how big are they.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: