5.54 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?     You can handle this by subclassing your grid and overriding either PreProcessMessage or ProcessDialogKey. The code below assumes your datasource is a dataview. If it is not, you could just remove that check 
 
[C#] 
 
public override bool PreProcessMessage( ref Message msg ) 
 

 
     Keys keyCode = (Keys)(int)msg.WParam & Keys.KeyCode; 
 
     if(msg.Msg == WM_KEYDOWN 
 
          && keyCode == Keys.Delete 
 
          && ((DataView) this.DataSource).AllowDelete) 
 
     { 
 
          if(MessageBox.Show("Delete this row?", "", MessageBoxButtons.YesNo) == DialogResult.No) 
 
               return true; 
 
     } 
 
     return base.PreProcessMessage(ref msg); 
 

  
解决了
呵呵
谁先来给谁分!