サマリ型セルで0を含む除算を除外するには?
対象製品
MultiRow for Windows Forms 10.0J
詳細
サマリ型セルでは0を含む除算を除外するには、SummaryCell.ShowDataErrorIconプロパティにTrueを設定します。
下記のコードは、TextBoxCell2の値が0の場合には除算を行わずにエラーアイコンを表示します。
[Visual Basic]
[C#]
下記のコードは、TextBoxCell2の値が0の場合には除算を行わずにエラーアイコンを表示します。
[Visual Basic]
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 ' エラーアイコンを表示する。 summaryCell1.ShowDataErrorIcon = True GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {textBoxCell1, textBoxCell2, summaryCell1})
[C#]
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; // エラーアイコンを表示する summaryCell1.ShowDataErrorIcon = true; gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { textBoxCell1, textBoxCell2, summaryCell1 });