ListViewInsertedEventArgs.Exception 속성

정의

삽입 작업을 진행하는 동안 발생한 예외가 있는 경우 이 예외를 가져옵니다.

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

속성 값

삽입 작업 과정에서 발생한 예외이거나, 예외가 발생하지 않은 경우에는 null입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 ListViewInsertedEventArgs 에 대 한 처리기에 전달 되는 개체는 ItemInserted 삽입 작업 중에 예외가 발생 했는지 여부를 결정 하는 이벤트입니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ListViewInsertedEventArgs 클래스입니다.

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

설명

예외가 발생 한 이벤트 처리기를 설정에 예외를 처리 하는 경우는 ExceptionHandled 속성을 true입니다. 이 고, 그렇지는 ListView 컨트롤이 다시 예외를 throw 합니다.

적용 대상

추가 정보