DataGridView - total amount of column?

Rhayezelle

Member
Joined
Aug 14, 2010
Messages
24
Location
Philippines
Programming Experience
Beginner
please help me... I have a datagrid view ang it has 3 columns.... MISC. ID, MISC TITLE, MISC AMOUNT... and i have a textbox that must display the total amount of the miscellaneous

for example i have already saved 5 types of MISC.. and i want to get all the value of MISC. AMOUNT... how can i get all the value? in order to compute the total amount of MISC?

all i can do is to get the data one by one by using e.currentrow but getting all the data in a particular column makes me confuse... please help me
 
Can also add another column to the DATATABLE and use DataColumn.Expression Property (System.Data) set to SUM([misc]) or whatever your column is called.. Now you'll have a column where every row contains the sum of all the values in [misc] column

This can hence be bound to a text box, and no matter what the current row, you will see an updated total in the textbox every time you edit
 
Back
Top