閱讀英文

共用方式為


DataGridViewRowCancelEventArgs 類別

定義

提供 UserDeletingRowDataGridView 事件的資料。

C#
public class DataGridViewRowCancelEventArgs : System.ComponentModel.CancelEventArgs
繼承
DataGridViewRowCancelEventArgs

範例

下列程式碼範例說明此類型的用法。 此範例是How to: Implement Virtual Mode in the Windows Forms DataGridView Control中提供之較大範例的一部分。

C#
private void dataGridView1_UserDeletingRow(object sender,
    System.Windows.Forms.DataGridViewRowCancelEventArgs e)
{
    if (e.Row.Index < this.customers.Count)
    {
        // If the user has deleted an existing row, remove the 
        // corresponding Customer object from the data store.
        this.customers.RemoveAt(e.Row.Index);
    }

    if (e.Row.Index == this.rowInEdit)
    {
        // If the user has deleted a newly created row, release
        // the corresponding Customer object. 
        this.rowInEdit = -1;
        this.customerInEdit = null;
    }
}

備註

若要取消刪除事件處理常式中的資料 UserDeletingRow 列,請將 Cancel 屬性設定為 true

如需如何處理事件的詳細資訊,請參閱 處理和引發事件

建構函式

屬性

Cancel

取得或設定值,這個值表示是否應該取消事件。

(繼承來源 CancelEventArgs)
Row

取得使用者要刪除的資料列。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

另請參閱