Click here to Skip to main content
14,735,289 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi am new to vb.net programming,would like to know how to create/code for calculated columns in datagridview such that say a column quantity*column sales=column total sales.any help will be appreciated
Posted

1 solution

you can do this in two way.
1. in your binding table, add a calculated column, and then bind that to the grid view
check the following link how to add the calculated column.
http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.90).aspx[^]
http://www.c-sharpcorner.com/blogs/5646/adding-a-calculated-column-to-a-datatable.aspx[^]

2. Using dataGridView1_CellValidated method and add the calculated value to new column.
http://stackoverflow.com/questions/6097370/calculation-in-datagridview-column[^]
   

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