Hi All :-)
Thanks for all of your help Cor :-)
I can not get the code you sent me to work in my application. I'm using an aspx datagrid in a web form. I'm getting the following error message when I try this code:
"Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier."
Dim dr2 As DataRow = dt_stat_report_3b.NewRow
Dim sum As Double = CDbl(dt_stat_report_3b.Compute("Sum(10-ld_act_125_gtr_fy_hh_avg)", ""))
dr2(10) = sum
dt_stat_report_3b.Rows.Add(dr2)
dt_stat_report_3b.Columns(11).Expression = "10-ld_act_125_gtr_fy_hh_avg" & sum.ToString
uwg_stat_rpt_3b.DataSource = dt_stat_report_3b
By way of explanation, I already have a For loop defined, and the columns created to hold both the values I'm trying to get the grand total for and the "Sum" column so I'm not showing that code. The column name is "10-ld_act_125_gtr_fy_hh_avg" and is the (10) column in the datagrid. The grand total column is the (11) column in the datagrid. I'm not multiplying by 100, because I don't want the actual percentage here, I want the calculation of the value from the row of column(10) divided by the grand total of column(10), so I don't need to multiply by 100.
Do you have any suggestions? I am at a loss, and at this point I'm going to have to duplicate all of my calculations from this datagrid and do them over again in a second datagrid, because the value in column 10 is calculated from column 3 and 4 in the current datagrid. This is basically a replication of an Excel Spreadsheet that our users have and they want an automated report. In order to get that report, I have to do calculations in almost EVERY column of this datagrid, and the datagrid consists of 14 columns! If you can provide any suggestions as to why I'm getting this error, I would greatly appreciate your help.
Thanks,
Coleen