Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
17403 | Aug 8,2004 12:39 AM UTC | Aug 9,2004 12:16 PM UTC | WinForms | 10 |
![]() |
Tags: GridControl |
double sum = 0; //assumes an AddNew row - if you don''t have one, use <=. for(int row = 1; row < this.mainGrid.Model.RowCount; ++row) { for(int col = 1; col <= this.mainGrid.Model.ColumnCount; ++col) { GridStyleInfo style = this.mainGrid[row, col]; string val = GetValueFromFormulaStyle(style); double d; if(double.TryParse(val, NumberStyles.Any, null, out d)) { sum += d; } } } private string GetValueFromFormulaStyle(GridStyleInfo style) { string val = style.Text; if(style.CellType == "FormulaCell") { if(style.FormulaTag != null&& style.FormulaTag.Text.Length > 0) { val = style.FormulaTag.Text;//used already calculated value } else { val = style.FormattedText;//trigger calculation } } return val; }
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.