Preventing the Delete button from deleting rows in a datagrid control.
Posted on 2004-09-29
I have a modified DataGrid control I'm using in my project. What I want to do is put a prompt at form level to ask the user if they are sure they want to delete a row, if not then cancel the delete method. How do I do this?? My control code is below.
Public Class ScheduleDataGrid
#Region " Windows Form Designer generated code "
Public Sub New()
'This call is required by the Windows Form Designer.
'Add any initialization after the InitializeComponent() call
'UserControl1 overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Name = "UserControl1"
Me.Size = New System.Drawing.Size(145, 151)
Protected Overrides Function IsInputKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean
If keyData = Keys.Delete Then
IsInputKey = True