Stop beep or ding sound in SFDataGrid Cell and Other syncfusion controls

How Stop beep or ding sound in SFDataGrid Cell and Other syncfusion controls in any case ?
Don't want sound in my whole application.

5 Replies

AA Arulraj A Syncfusion Team September 18, 2018 12:15 PM UTC

Hi Avinash, 

SfDataGrid doesn’t have direct support to disable this sound, which occurs when pressing Tab, Enter and Escape keys 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. Please refer to the following code example to achieve this in text column. 

Code Example : 

public Form1() 
{ 
    InitializeComponent(); 
    orderInfo = new OrderInfoCollection(); 
    this.sfDataGrid1.DataSource = orderInfo.OrdersListDetails; 
 
    this.sfDataGrid1.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.Enter || e.KeyCode == Keys.Tab || e.KeyCode == Keys.Escape) 
            e.SuppressKeyPress = true; 
    } 
} 

You can make use of this approach for the GridComboBoxColumn and UnboundColumn also. Please refer to the sample from the following location. 

 
Arulraj A 



AV Avinash September 23, 2018 05:36 PM UTC

This is done for MessgaeBox.Show() ???


AA Arulraj A Syncfusion Team September 24, 2018 11:50 AM UTC

Hi Avinash, 

Thanks for your update. 

The solution provided in our previous update will disables only the sound that occurs while pressing enter, tab or escape key on the SfDataGrid cells. It will never disable the sound for the whole application. The sound that occurs while showing the MessageBox is selected from the MessageBoxIcon value passed in MessageBox.Show() method. Setting MessageBoxIcon to None will never produce any sound while showing the MessageBox. Please refer to the following MSDN forum links regarding the MessageBox sound. 

MSDN forum links: 

Regards, 
Arulraj A 



NS Nicolas Schioldann February 24, 2021 01:04 PM UTC

Hi

The code works just fine, and removes the beeb.  But it also removes the abillity to press Del and delete a row.  

What to do?

Thanks 
Nicolas

                this.sfDataGrid1.View.Records.CollectionChanged += Records_CollectionChanged;
                sfDataGrid1.CurrentCellEndEdit += SfDataGrid1_CurrentCellEndEdit;
                sfDataGrid1.RecordDeleting += SfDataGrid1_RecordDeleting;
                this.sfDataGrid1.CellRenderers["TextBox"] = new GridTextBoxCellRendererExt();
                sfDataGrid1.CurrentCellActivated += SfDataGrid_CurrentCellActivated;

************ EDIT ********************
Made a delete button in each row, so I've solved the problem that way.




VS Vijayarasan Sivanandham Syncfusion Team February 25, 2021 02:26 PM UTC

Hi Nicolas Schioldann, 

Thanks for the update.
 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊. 
 
Regards, 
Vijayarasan S 


Loader.
Up arrow icon