I need to add some "total rows" to a table. The code I am currently using for the sub totals is:
DataRow shRow = ds.Tables[0].NewRow();
shRow["a"] = "SubHead";
shRow["b"] = "Wheel Subs";
shRow["c"] = totalWheels;
Since I need totals and sub totals and sub sub totals I have to cut and paste this code (changing the values) for each new sub total.
I would like to have a function that takes the current table and values and adds the new row. Something like:
public DataRow SubRow(DataTable ResultsTable, string SubHead, string SubHeader, string SubHeadValue)
That would then update the table in the main function.
Thanks for any help. I just can't 'pass' the table to and from the new function.