Specifies the cell's value.
|Item as Variant||A long expression that indicates the item's handle.|
|ColIndex as Variant||A long expression that indicates the cell's handle or the column's index, a string expression that indicates the column's caption or the column's key. If the Item parameter is missing or it is zero ( 0 ), the ColIndex parameter is the handle of the cell being accessed.|
|Variant||A variant expression that indicates the cell's value. The cell's value supports built-in HTML format if the CellValueFormat property is exHTML.|
Use the CellValue property to specify the value for cells in the second, third columns and so on. The Change event is called when the user changes the CellValue property. Use the CellData property to associate an user data to a cell. The AddItem or InsertItem method may specify the value for the first cell. Use the LockedItemCount property to lock or unlock items to the top or bottom side of the control. Use the ItemCell property to get the cell's handle based on the item and the column. Use the CellItem property to get the handle of the item that's the owner of the cell. Use the SplitCell property to split a cell. If the CauseValidateValue property is True, the control fires the ValidateValue property when the user changes the CellValue property. Use the AddItem method to add new predefined values to a drop down list editor. Use the CellEditor property to assign an editor to a single cell. Use the Editor property to assign the same editor to all cells in the column. Use the Add method to add new columns to the control. Use the <img> HTML tag to insert icons inside the cell's caption, if the CellValueFormat property is exHTML. Use the FormatColumn property to format the column. The AllowCellValueToItemBar property allows the cells to display properties of the bars.
The CellValue property indicates the formula being used to compute the field, if the CellValueFormat property is exComputedField. The ComputedField property specifies the formula to compute the entire column.
The cell shows its text based on the CellValueFormat property as follows:
The CellValue property of the cell is being shown as:
In other words, all cells applies the format of the FormatColumn property, excepts the cells with the FormatCell property being set. If the cell belongs to a column with the FireFormatColumn property on True, the Value parameter of the FormatColumn event shows the newly caption for the cell to be shown
The following VB sample displays an HTML cell on multiple lines:
With G2antt1.Items Dim h As HITEM h = .AddItem("Cell 1") .CellValue(h, 1) = "<r><dotline><b>HTML support</b><br>This is a bit of text where built-in <b>HTML</b> support is enabled." .CellValueFormat(h, 1) = exHTML .CellSingleLine(h, 1) = False .CellEditorVisible(h, 1) = False End With
The following C++ changes the value of the focused cell:
#include "Items.h" CItems items = m_g2antt.GetItems(); COleVariant vtItem( items.GetFocusItem() ), vtColumn( long(m_g2antt.GetFocusColumnIndex()) ); items.SetCellValue( vtItem, vtColumn, COleVariant("new value") );
The following VB.NET changes the value of the focused cell:
With AxG2antt1.Items .CellValue(.FocusItem, AxG2antt1.FocusColumnIndex) = "new value" End With
The following C# changes the value of the focused cell:
axG2antt1.Items.set_CellValue(axG2antt1.Items.FocusItem, axG2antt1.FocusColumnIndex, "new value");
The following VFP changes the value of the focused cell:
with thisform.G2antt1.Items .DefaultItem = .FocusItem .CellValue(0,thisform.G2antt1.FocusColumnIndex) = "new value" endwith
You may include strings like [m²], [m³], [180º], ¼ml, or ½m², ¾m³, and so on. Copy the symbol from this page, and paste to your cell.
Note: The intersection of an item with a column defines a cell. Each cell is uniquely represented by its handle. The cell's handle is of HCELL type, that's equivalent with a long type. All properties of Items object that have two parameters Item and ColIndex, refer a cell.
The following lines are equivalents and each of them changes the bold font attribute of the first cell on the first item.
With G2antt1 .Items.CellBold(, .Items.ItemCell(.Items(0), 0)) = True .Items.CellBold(.Items(0), 0) = True .Items.CellBold(.Items(0)) = True .Items.CellBold(.Items.ItemByIndex(0)) = True .Items.CellBold(.Items.ItemByIndex(0), 0) = True .Items.CellBold(.Items(0), G2antt1.Columns(0).Caption) = True End With
Send comments on this topic. © 1999-2017 Exontrol.COM, Software. All rights reserved.