Articles in this section
Category / Section

How to use VLOOKUP formula in WinForms GridControl?

1 min read

VLookup formula

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

C#:

// 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;

 

VB:

' 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 VLOOKUP formula and the syntax for the VLOOKUP is,
VLOOKUP(lookup_value,table_array,row_index_num,range_lookup)

C#:

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

 

VB:

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

 

 

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)
Please sign in to leave a comment
Access denied
Access denied