Click here to Skip to main content
15,905,427 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to multiply two cell value.and after leaving second cell the answer should be display in third cell...
Posted
Comments
Sergey Alexandrovich Kryukov 10-Feb-12 2:58am    
OK, and what's the problem? Handle this event... This is not even a question.
Windows.Forms? Tag "WinForm".
--SA

1 solution

Use this code

C#
private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
 {
   if (e.ColumnIndex == 1) //if second cell
    {
       dataGridView1.Rows[e.RowIndex].Cells[2].Value =   Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[0].Value) * Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[1].Value);
 }
}
 
Share this answer
 
Comments
thakurajay93 11-Feb-12 1:58am    
thanks bro

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