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

datagrid traps 2nd delete key not first

Thread ID:




39821 Jan 19,2006 03:50 AM UTC WinForms 0
Tags: FAQ
Asked On January 19, 2006 03:50 AM UTC

First of all, thanks for the ton of information!!!! I followed your advice in the following section trying to prevent rows from being deleted in my datagrid. It works great EXCEPT for the first time the DEL key is pressed. 5.58 How can I put up a confirmation question when the user tries to delete a row in the datagrid by clicking on the row header and pressing the Delete key? The following is my code. I think it is exactly like your. Is there a way to trap the first “DEL” key???? Public Class DataGrid_Custom Inherits Windows.Forms.DataGrid Private Const WM_KEYDOWN = &H100 Public Overrides Function PreProcessMessage(ByRef msg As System.Windows.Forms.Message) As Boolean Dim keyCode As Keys = CType((msg.WParam.ToInt32 And Keys.KeyCode), Keys) If msg.Msg = WM_KEYDOWN And keyCode = Keys.Delete Then If MessageBox.Show("Delete This Row?", "Confirm Delete", MessageBoxButtons.YesNo) = DialogResult.No Then Return True End If End If Return MyBase.PreProcessMessage(msg) End Function End Class


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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