ListViewInsertedEventArgs.Exception Özellik

Tanım

Ekleme işlemi sırasında oluşturulan özel durumu (varsa) alır.

public:
 property Exception ^ Exception { Exception ^ get(); };
public Exception Exception { get; }
member this.Exception : Exception
Public ReadOnly Property Exception As Exception

Özellik Değeri

Ekleme işlemi sırasında oluşturulan özel durum veya null herhangi bir özel durum tetiklendi.

Örnekler

Aşağıdaki örnekte, ekleme işlemi sırasında bir özel durumun tetiklenip tetiklenmediğini belirlemek için olay işleyicisine ItemInserted geçirilen nesnenin nasıl kullanılacağı ListViewInsertedEventArgs gösterilmektedir. Bu kod örneği, sınıfı için ListViewInsertedEventArgs sağlanan daha büyük bir örneğin parçasıdır.

void ContactsListView_ItemInserted(Object sender, ListViewInsertedEventArgs e)
{
  if (e.Exception != null)
  {
    if (e.AffectedRows == 0)
    {
      e.KeepInInsertMode = true;
      Message.Text = "An exception occurred inserting the new Contact. " +
        "Please verify your values and try again.";
    }
    else
      Message.Text = "An exception occurred inserting the new Contact. " +
        "Please verify the values in the newly inserted item.";

    e.ExceptionHandled = true;
  }
}
Sub ContactsListView_ItemInserted(ByVal sender As Object, ByVal e As ListViewInsertedEventArgs)

  If e.Exception IsNot Nothing Then

    If e.AffectedRows = 0 Then
      e.KeepInInsertMode = True
      Message.Text = "An exception occurred inserting the new Contact. " & _
        "Please verify your values and try again."
    Else
      Message.Text = "An exception occurred inserting the new Contact. " & _
        "Please verify the values in the newly inserted item."
    End If

    e.ExceptionHandled = True
  End If
End Sub

Açıklamalar

Bir özel durum oluşturulduysa ve olay işleyicisinde özel durumu işlerseniz özelliğini olarak trueayarlayınExceptionHandled. Aksi takdirde, ListView denetim özel durumu yeniden oluşturur.

Şunlara uygulanır

Ayrıca bkz.