Spread Windows Forms 7.0 Product Documentation
Value Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > Cell Class : Value Property


Glossary Item Box

Gets or sets the value in a cell.

Syntax

Visual Basic (Declaration) 
Public Property Value As Object
Visual Basic (Usage)Copy Code
Dim instance As Cell
Dim value As Object
 
instance.Value = value
 
value = instance.Value
C# 
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.
C#Copy Code
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() + ")";    
}
Visual BasicCopy Code
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

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.