DataGridViewRowsRemovedEventArgs 類別

定義

提供 RowsRemoved 事件的資料。

public ref class DataGridViewRowsRemovedEventArgs : EventArgs
public class DataGridViewRowsRemovedEventArgs : EventArgs
type DataGridViewRowsRemovedEventArgs = class
    inherit EventArgs
Public Class DataGridViewRowsRemovedEventArgs
Inherits EventArgs
繼承
DataGridViewRowsRemovedEventArgs

範例

下列程式碼範例示範此類型的用法。 在此範例中,事件處理常式會報告事件發生次數 RowsRemoved 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。 若要報告多個事件或經常發生的事件,請考慮將 取代 ShowConsole.WriteLine 為 或將訊息附加至多行 TextBox

若要執行範例程式碼,請將它貼到包含名為 DataGridView1 之型 DataGridView 別實例的專案。 然後,確定事件處理常式與事件相關聯 RowsRemoved

private void DataGridView1_RowsRemoved(Object sender, DataGridViewRowsRemovedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowCount", e.RowCount );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowsRemoved Event" );
}
Private Sub DataGridView1_RowsRemoved(sender as Object, e as DataGridViewRowsRemovedEventArgs) _ 
     Handles DataGridView1.RowsRemoved

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "RowCount", e.RowCount)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RowsRemoved Event")

End Sub

備註

從 控制項中刪除 DataGridView 資料列時,後續資料列的索引編號會降低以補償。

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

建構函式

DataGridViewRowsRemovedEventArgs(Int32, Int32)

初始化 DataGridViewRowsRemovedEventArgs 類別的新執行個體。

屬性

RowCount

取得已刪除的資料列數目。

RowIndex

取得已刪除的資料列之以零起始的索引;如果刪除了多個資料列,則為第一個被刪除的資料列。

方法

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

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

(繼承來源 Object)

適用於

另請參閱