We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to suspend the PING sound when perform the Tab operation in DataGrid(SfDataGrid)?

Platform: WinForms |
Control: SfDataGrid |
Published Date: March 19, 2020 |
Last Revised Date: March 25, 2020

SfDataGrid doesn’t have direct support to disable this sound, which occurs when pressing Tab key on the TextBox. It is the behavior of the default TextBox. However, you can disable this by enabling the SuppressKeyPress property within the KeyDown event of the TextBox. In SfDataGrid cells this can be achieved by creating custom renderer.

this.sfDataGrid.CellRenderers["TextBox"] = new GridTextBoxCellRendererExt(); 
 
class GridTextBoxCellRendererExt : GridTextBoxCellRenderer 
{ 
    protected override void OnInitializeEditElement(DataColumnBase column, Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex rowColumnIndex, TextBox uiElement) 
    { 
        base.OnInitializeEditElement(column, rowColumnIndex, uiElement); 
        uiElement.KeyDown += uiElement_KeyDown; 
    } 
 
    protected override void OnUnwireEditUIElement(TextBox uiElement) 
    { 
        base.OnUnwireEditUIElement(uiElement); 
        uiElement.KeyDown -= uiElement_KeyDown; 
    } 
 
    void uiElement_KeyDown(object sender, KeyEventArgs e) 
    { 
        if (e.KeyCode == Keys.Tab) 
            e.SuppressKeyPress = true; 
    } 
} 
 

 

View Sample in GitHub

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon