Share via


DataGridViewRowCancelEventArgs.Row Özellik

Tanım

Kullanıcının silmekte olduğu satırı alır.

public:
 property System::Windows::Forms::DataGridViewRow ^ Row { System::Windows::Forms::DataGridViewRow ^ get(); };
public:
 property System::Windows::Forms::DataGridViewRow ^ Row { System::Windows::Forms::DataGridViewRow ^ get(); void set(System::Windows::Forms::DataGridViewRow ^ value); };
public System.Windows.Forms.DataGridViewRow Row { get; }
public System.Windows.Forms.DataGridViewRow Row { get; set; }
public System.Windows.Forms.DataGridViewRow? Row { get; set; }
member this.Row : System.Windows.Forms.DataGridViewRow
member this.Row : System.Windows.Forms.DataGridViewRow with get, set
Public ReadOnly Property Row As DataGridViewRow
Public Property Row As DataGridViewRow

Özellik Değeri

Kullanıcının sildiği satır.

Örnekler

Aşağıdaki kod örneğinde bu türün kullanımı gösterilmektedir. Bu örnek, How to: Implement Virtual Mode in the Windows Forms DataGridView Control (Windows Forms DataGridView Denetiminde Sanal Mod Uygulama) bölümünde bulunan daha büyük bir örneğin parçasıdır.

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 = nullptr;
   }
}
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;
    }
}
Private Sub dataGridView1_UserDeletingRow(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) _
    Handles dataGridView1.UserDeletingRow

    If e.Row.Index < Me.customers.Count Then

        ' If the user has deleted an existing row, remove the 
        ' corresponding Customer object from the data store.
        Me.customers.RemoveAt(e.Row.Index)

    End If

    If e.Row.Index = Me.rowInEdit Then

        ' If the user has deleted a newly created row, release
        ' the corresponding Customer object. 
        Me.rowInEdit = -1
        Me.customerInEdit = Nothing

    End If

End Sub

Şunlara uygulanır

Ayrıca bkz.