Articles in this section
Category / Section

How to perform SpellChecker in WinForms GridControl, GridGroupingControl and GridDataBoundGrid?

3 mins read


The Essential Grid does not have direct support for SpellChecker. In order to achieve SpellChecker in Grid, you need to customize the Grid by creating the custom cell renderer and cell model. Refer to the following article link to know more about the creating cell renderer and cell model

How to create the Cell Model and Cell Renderer?


In this article, the SpellChecker component is used to validate the strings in the cell. Based on the result, the cell text is underlined when the text is misspelled, since customization for multiple words is not provided. To know more about the SpellChecker component, you can refer to the following link: Spellchecker

Creating cell renderer and cell model:


public class SpellCheckCellRenderer : GridTextBoxCellRenderer
    //Using SpellChecker tool.
    private SpellChecker spellchecker;
    public SpellCheckCellRenderer(GridControlBase grid, GridCellModelBase cellModel) : base(grid, cellModel)
        spellchecker = new SpellChecker();
    //To underline the word in cell that is misspelled.
    protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
       //Validate the cell values.
       string check = this.spellchecker.SpellCheck(style.CellValue.ToString());
       //Checking whether the result has suggestions.
       if(check != "")
          style.Font.Underline = true;
       base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);
public class SpellCheckCellModel : GridTextBoxCellModel
    ///Initializes a new <see cref="PercentTextBoxCellModel"/>
    ///<param name="grid">GridModel.</param>
    public SpellCheckCellModel(GridModel grid) : base(grid)
    {    }
    /// <summary>
    /// Creates a cell renderer.
    /// </summary>
    /// <param name="control">GridControlBase</param>
    /// <returns>A new <see cref="PercentTextBoxCellRenderer"/>specific for a <see cref="GridControlBase"/></returns>
    public override GridCellRendererBase CreateRenderer(GridControlBase control)
        return new SpellCheckCellRenderer(control, this);


Public Class SpellCheckCellRenderer
    Inherits GridTextBoxCellRenderer
    Private spellchecker As SpellChecker
    Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase)
       MyBase.New(grid, cellModel)
       spellchecker = New SpellChecker()
    End Sub
    ‘To underline the word in cell that is misspelled.
    Protected Overrides Sub OnDraw(ByVal g As Graphics, ByVal clientRectangle As Rectangle, ByVal rowIndex As Integer, ByVal colIndex As Integer, ByVal style As GridStyleInfo)
       If style.CellValue IsNot Nothing Then
          Dim check As String = Me.spellchecker.SpellCheck(style.CellValue.ToString())
          'To check whether value has suggestion.
          If check <> "" Then
   style.Font.Underline = True
          End If
       End If
       MyBase.OnDraw(g, clientRectangle, rowIndex, colIndex, style)
    End Sub
End Class
Public Class SpellCheckCellModel
    Inherits GridTextBoxCellModel
    '''Initializes a new <see cref="PercentTextBoxCellModel"/>
    '''<param name="grid">GridModel.</param>
    Public Sub New(ByVal grid As GridModel) 
    End Sub 
    ''' <summary>
    ''' Creates a cell renderer.  
    ''' </summary>
    ''' <param name="control">GridControlBase</param>
    ''' <returns>A new <see cref="PercentTextBoxCellRenderer"/>specific for a <see cref="GridControlBase"/></returns>
    Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase
       Return New SpellCheckCellRenderer(control, Me)
    End Function
End Class

Adding cell model and assigning CellType:

For GridControl:


//Add the Custom Cell Model to Grid.
this.gridControl1.CellModels.Add("SpellCheckCell", new SpellCheckCellModel(this.gridControl1.Model));
//Set the Custom Cell Type.
this.gridControl1.TableStyle.CellType = "SpellCheckCell";


'Add the Custom Cell Model to Grid.
Me.gridControl1.CellModels.Add("SpellCheckCell", New SpellCheckCellModel(Me.gridControl1.Model))
'Set the Custom Cell Type.
Me.gridControl1.TableStyle.CellType = "SpellCheckCell"

For GridGroupingControl:


//Add the Custom Cell Model to Grid.
this.gridGroupingControl1.TableModel.CellModels.Add("SpellCheckCell", new SpellCheckCellModel(this.gridGroupingControl1.TableModel));
//Set the Custom Cell Type.
this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.CellType = "SpellCheckCell";


'Add the Custom Cell Model to Grid.
Me.gridGroupingControl1.TableModel.CellModels.Add("SpellCheckCell", New SpellCheckCellModel(Me.gridGroupingControl1.TableModel))
'Set the Custom Cell Type.
Me.gridGroupingControl1.TableDescriptor.Columns(1).Appearance.AnyRecordFieldCell.CellType = "SpellCheckCell"

For GridDataBoundGrid:


//Add the Custom Cell Model to Grid.
this.gridDataBoundGrid1.Model.CellModels.Add("SpellCheckCell", new SpellCheckCellModel(this.gridDataBoundGrid1.Model));
//Set the Custom Cell Type.
this.gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.CellType = "SpellCheckCell";


'Add the Custom Cell Model to Grid.
Me.gridDataBoundGrid1.Model.CellModels.Add("SpellCheckCell", New SpellCheckCellModel(Me.gridDataBoundGrid1.Model))
'Set the Custom Cell Type.
Me.gridDataBoundGrid1.Binder.InternalColumns(1).StyleInfo.CellType = "SpellCheckCell"


Show the spell checking process in grid

Figure 1: Output



C#: SpellChecker_GridControl_CS

VB: SpellChecker_GridControl_VB


C#: SpellChecker_GGC_CS

VB: SpellChecker_GGC_VB


C#: SpellChecker_GDBG_CS

VB: SpellChecker_GDBG_VB

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment