Articles in this section

How to use VLOOKUP formula in WinForms GridControl?

VLookup formula


To use the VLOOKUP formula by assigning the CellType property as FormulaCell to the specified grid cells. Refer to the code below to enable the formula cell and the syntax for using the VLOOKUP formula.

// Sets the entire Grid cells as FormulaCell.
this.gridControl1.BaseStylesMap["Standard"].StyleInfo.CellType = GridCellTypeName.FormulaCell;

// Sets the specific cell as FormulaCell.
this.gridControl1[5, 5].CellType = GridCellTypeName.FormulaCell;

// Sets the specific row as FormulaCell.
this.gridControl1.Model.RowStyles[7].CellType = GridCellTypeName.FormulaCell;

// Sets the specific column as FormulaCell.
this.gridControl1.Model.ColStyles[4].CellType = GridCellTypeName.FormulaCell;
'Sets the entire Grid cells as FormulaCell.
Me.gridControl1.BaseStylesMap("Standard").StyleInfo.CellType = GridCellTypeName.FormulaCell

'Sets the specific cell as FormulaCell.
Me.gridControl1(5, 5).CellType = GridCellTypeName.FormulaCell

'Sets the specific row as FormulaCell.
Me.gridControl1.Model.RowStyles(7).CellType = GridCellTypeName.FormulaCell

'Sets the specific column as FormulaCell.
Me.gridControl1.Model.ColStyles(4).CellType = GridCellTypeName.FormulaCell 

CellValue can be assigned by using the VLOOKUP formula, and the syntax for the VLOOKUP is,
VLOOKUP(lookup_value,table_array,row_index_num,range_lookup)


// The value "Data3" is looked up in the grid.
this.gridControl1[2, 4].CellValue = "=vlookup(\"Data3\",A1:C4,3,false)";
' The value "Data3" is looked up in the grid.
Me.gridControl1(2, 4).CellValue = "=vlookup(""Data3"",A1:C4,3,false)"

The screenshot below displays the Vlookup formula in grid cells.


Show the VLoopkup formula in grid

Samples:

C#: VLOOKUP

VB: VLOOKUP

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied