GrapeCity MultiRow Windows Forms Documentation
Displaying an Error Icon for Data Errors (SummaryCell)

In the summary cell, if a number is divided by zero, or if a non-numeric value is set in the calculating formula which results in a data error in the calculated value, then you can display an error icon.

Error Icon for Data Error

Using the Designer

  1. Add two text box cells to the Row (for example: textBoxCell1, textBoxCell2).
  2. Set the textBoxCell1.Value property to "10", and set the textBoxCell2.Value property to "1".
  3. Add a SummaryCell in the Row (for example: summaryCell1).
  4. Add a SummaryCell in the column footer (ColumnFooterSection). For example: summaryCell1.
  5. Select the summaryCell1, and from the Properties window, select Expression from the drop-down list of the Calculation property.
  6. Click the plus sign at the right of the summaryCell1.Calculation property, then click the ... button of the ExpressionString property to open the Expression Editor.
  7. Set "textBoxCell1/textBoxCell2" in the Expression Editor, then click the OK button.
  8. Set the summaryCell1.ShowDataErrorIcon property to True.
  9. Run the project, enter "10" in textBoxCell1, and "1" in textBoxCell2, and check that the calculation result is displayed in the summary cell.
  10. Enter "0" in the textBoxCell2, and check that the error icon is displayed.
  11. Enter "a" in the textBoxCell1, "1" in the textBoxCell2, and check that the error icon is displayed.

Using Code

This example shows an error icon.

[VB]

Imports GrapeCity.Win.MultiRow 
Dim textBoxCell1 As New TextBoxCell() 
textBoxCell1.Name = "textBoxCell1"
textBoxCell1.Value = 10 
Dim textBoxCell2 As New TextBoxCell() 
textBoxCell2.Name = "textBoxCell2" 
textBoxCell2.Value = 0 
Dim expression1 = New GrapeCity.Win.MultiRow.Expression() 
expression1.ExpressionString = "textBoxCell1 / textBoxCell2" 
Dim summaryCell1 As New SummaryCell() 
summaryCell1.Name = "summaryCell1" 
summaryCell1.Calculation = expression1 
' Display the error icon. 
summaryCell1.ShowDataErrorIcon = True 
GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {textBoxCell1, textBoxCell2, summaryCell1})

[CS]

using GrapeCity.Win.MultiRow; 
TextBoxCell textBoxCell1 = new TextBoxCell(); 
textBoxCell1.Name = "textBoxCell1";
textBoxCell1.Value = 10; 
TextBoxCell textBoxCell2 = new TextBoxCell(); 
textBoxCell2.Name = "textBoxCell2"; 
textBoxCell2.Value = 0; 
Expression expression1 = new GrapeCity.Win.MultiRow.Expression(); 
expression1.ExpressionString = "textBoxCell1 / textBoxCell2"; 
SummaryCell summaryCell1 = new SummaryCell();
summaryCell1.Name = "summaryCell1"; 
summaryCell1.Calculation = expression1; 
// Display the error icon 
summaryCell1.ShowDataErrorIcon = true;
gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { textBoxCell1, textBoxCell2, summaryCell1 });
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options