Spread Windows Forms 12.0 Product Documentation
Value Property (Cell)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > Cell Class : Value Property
Gets or sets the value in a cell.
Syntax
'Declaration
 
Public Property Value As Object
'Usage
 
Dim instance As Cell
Dim value As Object
 
instance.Value = value
 
value = instance.Value
public object Value {get; set;}

Property Value

Object containing unformatted data
Remarks

This property gets or sets the raw unformatted data in a cell. The data handled with this property is placed directly in the data model and is not parsed or formatted.

This property is available at run time only.

The CheckBoxCellType can represent either a two-state check box or a three-state check box. (Refer to the ThreeState property.) When representing a two-state check box, the states of unchecked and check produce cell values of false and true respectively. When representing a three-state check box, the states of unchecked, checked, and indeterminate produce cell values of 0,1, and 2 respectively.

The Value property may be null if the cell is empty (that is, contains no data). Before a check box cell (CheckBoxCellType) is set, it contains no data, so appears the same as unchecked.

Besides using this property, you can get or set the value in a cell using several methods available at the sheet level (with the SheetView object). For more information, see Handling Data Using Sheet Methods.

Remember that the data may be displayed differently in a cell depending on the cell type. For more information, see Understanding Cell Type Effects on Displaying Data.

Example
This example creates a Cell object and uses its formula property to sum the values of two cells.
using FarPoint.Win.Spread;
using FarPoint.Win;

private void Form1_Load(object sender, System.EventArgs e)
{
     Cell acell, mycell, urcell;
     acell = fpSpread1.ActiveSheet.Cells[0, 0];
     mycell = fpSpread1.ActiveSheet.Cells[2, 2];
     urcell = fpSpread1.ActiveSheet.Cells[2, 3];
     mycell.Value = 10;
     urcell.Value = 10;
     acell.Formula = "SUM(" + mycell.ToString() + "," + urcell.ToString() + ")";    
}
Imports FarPoint.Win.Spread
Imports FarPoint.Win

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Dim acell, mycell, urcell As FarPoint.Win.Spread.Cell
     acell = fpSpread1.ActiveSheet.Cells(0, 0)
     mycell = fpSpread1.ActiveSheet.Cells(2, 2)
     urcell = fpSpread1.ActiveSheet.Cells(2, 3)
     mycell.Value = 10
     urcell.Value = 10
     acell.Formula = "SUM(" + mycell.ToString() + "," + urcell.ToString() + ")"
End Sub
See Also

Reference

Cell Class
Cell Members
Text Property
GetArray Method
GetClipValue Method
SetArray Method
SetClipValue Method
GetValue Method
SetValue Method

User-Task Documentation

Handling Data Using Cell Properties