ListViewInsertedEventArgs.ExceptionHandled 속성

정의

삽입 작업 과정에서 발생한 예외를 이벤트 처리기에서 처리했는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool ExceptionHandled { bool get(); void set(bool value); };
public bool ExceptionHandled { get; set; }
member this.ExceptionHandled : bool with get, set
Public Property ExceptionHandled As Boolean

속성 값

예외가 이벤트 처리기에서 처리되었으면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 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, 예외 처리 및 다시 throw 되지 않습니다 것으로 간주 됩니다. 이 속성 설정 된 경우 false, ListView 컨트롤이 다시 예외를 throw 합니다. 발생 한 예외를 확인 하려면 사용 된 Exception 속성입니다.

적용 대상

추가 정보