I want to remove a column from datatable
the column is a part of expression I want to remove it once the expression is calculated.
Lower.Expression = "(Convert(µ,'System.Double')-Convert(LSL,'System.Double'))/(3.0*sigma)";
Upper.Expression = "(Convert(USL,'System.Double')-Convert(µ,'System.Double'))/(3.0*sigma)";
CpK.Expression = "IIF(Lower < Upper, Lower, Upper)";
I want to remove lower and upper once the data is populated
Remove column which has expression set
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Farhan ShariffRank #2,004 · 725 reputationPosted Mar 20, 2014, 2:31 AM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 20, 2014, 2:47 AM EDT
If you really need to do this, then you'd have to forego setting the Expression property and simply calculate the values of the 'computed' column manually before removing the 'surplus' columns.
Secondly, you can't hide columns in a DataTable because the DataColumn class doesn't have a Visible property - hence the exception you're getting. What you could do is to bind the table to (say) a DataGridView and then hide the appropriate columns of that.