2011-01-26 4 views

答えて

2

LostFocusイベントを使用してこれを行うことができます。

//Short Version 
gridview1.LostFocus += (sender, e) => {//Your code to close edit mode}; 

それとも通常通りあなたはそれを行うだろう:私はあなたがしたくないと思う

public void gridview1_LostFocus(object sender, RoutedEventArgs e) 
{ 
    //Your code to close edit mode 
} 
1

をhandelingイベントのためにあなたの方法を定義

//Normal long Version 
gridview1.LostFocus += new EventHandler(gridview1_LostFocus); 

一部ユーザーがセル値を編集できるようにする

dataGridView1.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dataGridView1_CellBeginEdit); 

のDataGridView CellBeginEditイベントを使用して、私はこのヘルプを願っています

private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) 
    { 
     e.Cancel = true; 
    } 

イベント処理で編集し、キャンセル。

関連する問題