none
how to sum a value of a datagrid column into a textbox in c#? RRS feed

  • Question

  • good day to the experts,

    my form has a parent table as a header, and a child table which is bound to a datagrid, and one of the column (amount), should be sum into a textbox under the grid as a net total for that particular record.

    how do i sum a value of a datagrid column into a textbox?

    thank you

     

     


    .madix_t
    Thursday, June 10, 2010 12:16 PM

Answers

  • You can use the myDataSet.Tables[0].Compute method to compute sum of columns.

    Or you can use the following method to create custom column for displaying sum.

    http://www.codeproject.com/KB/aspnet/SumColumn.aspx


    Regards
    Nayan Paregi (MCTS)
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, June 10, 2010 12:30 PM

All replies

  • You can use the myDataSet.Tables[0].Compute method to compute sum of columns.

    Or you can use the following method to create custom column for displaying sum.

    http://www.codeproject.com/KB/aspnet/SumColumn.aspx


    Regards
    Nayan Paregi (MCTS)
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, June 10, 2010 12:30 PM
  • thank you Nayan for your help
    .madix_t
    Friday, June 11, 2010 7:57 AM