2014-08-31 60 views
1

我創造的DataGridView 的用戶控件,我找外地的情況下離開 我的意思是在任何領域尋找事件的DataGridView

爲例失去焦點:

enter image description here

你在編輯模式下看到它(在姓氏的第一行),我想每次使用事件我失去了編輯任何字段後的焦點 哪些事件我可以使用?

我不能使用datagridview.click因爲它只有當我失去重心的另一列,但我想對,如果我點擊了「第二次上」按鈕還是做失去焦點

編輯此外,我需要另外1個活動 上的錯誤,我的意思是,如果我把INT場我寫的信我想它告訴我錯誤

回答

2

您正在尋找DataGridView.CellEndEdit事件

+0

TY發現它的工作完美 你能再次幫助我,我想找到事件發生或錯誤或在編輯列/行之前如果我輸入字符串到Int我想要事件來檢查它或發生錯誤的事件 – 2014-08-31 10:17:53

+0

[看看這是否有幫助](http://msdn.microsoft.com/en-us/library/system.windows.forms。 datagridview.dataerror%28v = vs.110%29.aspx) – 2014-08-31 10:21:10

+0

謝謝你這兩個完美的!!!! :) private void dataGridView1_CellEndEdit(object sender,DataGridViewCellEventArgs e) { ad.update(); } private void dataGridView1_DataError(object sender,DataGridViewDataErrorEventArgs e) e.Cancel = false; MessageBox.Show(「שגיאהבסוגנתונים」); } – 2014-08-31 10:26:03