次のサンプルコードでは、通貨型セルの列を作成して最初のセルに値を設定し、その値が有効かどうかをチェックして結果をテキストボックスに表示しています。
private void Page_Load(object sender,System.EventArgs e)
{
if (this.IsPostBack) Return;
FpSpread1.ActiveSheetView.Columns[0].CellType = new FarPoint.Web.Spread.CurrencyCellType();
FpSpread1.ActiveSheetView.SetValue(0, 0, 108.89);
}
private void Button1_Click(object sender,System.EventArgs e)
{
object val = FpSpread1.ActiveSheetView.Cells[0, 0].Value;
string reason;
reason = FpSpread1.Validate(val, 0, 0);
if (reason == null || reason == String.Empty){
TextBox1.Text = "Valid";
}
else{
TextBox1.Text = reason;
}
}
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load
If Me.IsPostBack Then Return
FpSpread1.ActiveSheetView.Columns(0).CellType=NewFarPoint.Web.Spread.CurrencyCellType()
FpSpread1.ActiveSheetView.SetValue(0, 0, 108.89)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click
Dim Val As Object=FpSpread1.ActiveSheetView.Cells[0, 0].Value
Dim reason As String
reason = FpSpread1.Validate(Val, 0, 0)
If reason = Nothing Or reason = String.Empty Then
TextBox1.Text="Valid"
Else
TextBox1.Text = reason
End If
End Sub