ListViewInsertedEventArgs.Exception Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
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
özel durum tetiklendiyse.
Örnekler
Aşağıdaki örnek, ekleme işlemi sırasında bir özel durumun tetiklenip tetiklenmediğini belirlemek üzere olay işleyicisine ItemInserted geçirilen nesnesinin nasıl kullanılacağını ListViewInsertedEventArgs gösterir. 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 true
ayarlayınExceptionHandled. Aksi takdirde, ListView denetim özel durumu yeniden oluşturur.