FlexGrid provides two ways to set values in cell. You can either use Item property (indexer) or SetData method of the C1FlexGrid class.
Use the code below to set a value in the WinForms FlexGrid cell.
To set values in a cell range, you can either use Data property of the CellRange class or SetData method of the C1FlexGrid class.
Following code shows how to set values in a cell range in WinForms FlexGrid.
There are two ways by which contents of cell or cell range can be cleared. You can either chose to do it programmatically by setting the content of cell to an empty string using indexer or SetData method. Or, you can set the AutoClipboard property to true so that user can delete the values by pressing the Delete key.
Below code demonstrates how to allow keyboard operations so that user can clear values from WinForms FlexGrid cells.
To set image in a cell, you can use SetCellImage method of the C1FlexGrid class. You can also set an image in a cell range by using Image property of the CellRange class. By default, text and image both are displayed in the cell. However, you can choose to display only image by setting the ImageAndText property to false.
Use the code below to set image in a WinForms FlexGrid cell.
To display partially hidden content of cells as tooltip, FlexGrid provides ShowCellLabels property of the C1FlexGrid class. You can also show additional information in the form of a tooltip by using the MouseEnterCell and MouseLeaveCell event.
Below code shows how to display a tooltip on a WinForms FlexGrid cell.
There are numerous ways using which you can fetch the value of FlexGrid cell/s depending on your requirement. Below table discusses several scenarios such as fetching the raw data or formatted data from a single cell or a cell range.
Requirement | Method/Property | Usage | ||||
---|---|---|---|---|---|---|
Get the raw data | Item property (indexer) |
|
||||
GetData() method |
|
|||||
Get the formatted data | GetDataDisplay() method |
|
||||
Get values of a cell range | Clip property |
|
||||
GetCellRange method |
|