Articles in this section
Category / Section

How to enable find and replace in WinForms GridGroupingControl?

1 min read

Find and replace

To implement find and replace with keyboard shortcut, you need to use the event TableControlCurrentCellKeyDown. The searching and replacing of text and numbers can be done as like the Find and Replace functionality in the Excel. This can be done by using dialog or programmatically. This can be achieved to the GridGroupingControl by creating a custom class GridFindReplaceDialog.

C#

// Displays the Find and Replace Dialog box.
void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
    if(e.Inner.Control)
    {
       if(e.Inner.KeyCode == Keys.F || e.Inner.KeyCode == Keys.H)
       {
          //if CTRL+F||CTRL+H is used, the findandreplacedialog will be displayed.
          GridFindReplaceDialog f = new GridFindReplaceDialog(this.gridGroupingControl1, "Metro");
          f.ShowDialog();
       }
    }
}

VB

'Displays the Find and Replace Dialog box.
Private Sub gridGroupingControl1_TableControlCurrentCellKeyDown(ByVal sender As Object, ByVal e As GridTableControlKeyEventArgs)
   If e.Inner.Control Then
      If e.Inner.KeyCode = Keys.F OrElse e.Inner.KeyCode = Keys.H Then
         'if CTRL+F||CTRL+H is used, the findandreplacedialog will be displayed.
         Dim f As New GridFindReplaceDialog(Me.gridGroupingControl1, "Metro")
         f.ShowDialog()
      End If
   End If
End Sub

 

Screenshot

Show the find and replace dialog box

Samples:

C#: FindandReplace_CS

VB: FindandReplace_VB

Reference link: https://help.syncfusion.com/windowsforms/gridgrouping/findandreplace

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