FormErrorCollection 클래스

현재 양식의 각 오류에 대한 FormError 개체를 포함합니다.

상속 계층 구조

System.Object
  Microsoft.Office.InfoPath.FormErrorCollection

네임스페이스:  Microsoft.Office.InfoPath
어셈블리:  Microsoft.Office.InfoPath(Microsoft.Office.InfoPath.dll)

구문

‘선언
Public MustInherit Class FormErrorCollection _
    Implements IEnumerable
‘사용 방법
Dim instance As FormErrorCollection
public abstract class FormErrorCollection : IEnumerable

주의

FormErrorCollection 개체는 관련된 양식에서 발생하는 모든 오류를 나타내는 FormError 개체의 모음을 포함합니다. 이러한 오류 모음에는 유효성 검사 오류, 시스템에서 생성된 오류, 사용자 정의(사용자 지정) 오류 등이 있습니다. FormErrorCollection 클래스는 포함된 FormError 개체를 추가하거나 삭제하고 액세스하는 데 사용할 수 있는 속성과 메서드를 제공합니다. 그러나 유효성 검사 오류 또는 시스템에서 생성된 오류는 이 컬렉션에서 삭제할 수 없습니다.

FormErrorCollection 클래스를 사용하면 InfoPath에서 생성된 오류를 관리할 수 있을 뿐만 아니라 Add 메서드를 사용하여 사용자 지정 오류를 만들 수도 있습니다.

참고 사항참고 사항

XmlValidatingEventArgs 클래스의 ReportError 메서드를 사용하여 사용자 지정 오류를 만들 수도 있습니다.

양식과 연결된 FormErrorCollection 개체에 액세스하려면 XmlForm 클래스의 Errors 속성을 사용합니다.

FormErrorCollection myErrors = this.Errors;
Dim myErrors As FormErrorCollection = Me.Errors

다음 예제에서는 먼저 오류를 연결할 필드에 XPathNavigator 개체를 배치한 후, XPathNavigator 및 오류 메시지 세부 정보를 FormErrorCollection 클래스의 Add 메서드에 전달하여 양식의 오류 모음에 오류를 추가합니다.

XPathNavigator root, txtbox;
// Create XPathNavigator for main data source.
root = this.MainDataSource.CreateNavigator();

// Create XPathNavigator positioned at field to associate with error.
txtbox = root.SelectSingleNode("//my:field1", this.NamespaceManager);

// Get form's collection of errors and add error.
this.Errors.Add(txtbox, "Field1Error", "Short error message.", 
   "Detailed error description.", 102057, ErrorMode.Modeless);
Dim root, txtbox As XPathNavigator
' Create XPathNavigator for main data source.
root = Me.MainDataSource.CreateNavigator()

' Create XPathNavigator positioned at field to add error.
txtbox = root.SelectSingleNode("//my:field1", Me.NamespaceManager)

' Get form's collection of errors and add error.
Me.Errors.Add(txtbox, "Field1Error", "Short error message.", 
   "Detailed error description.", 102057, ErrorMode.Modeless)

스레드 보안

이 형식의 모든 공용 static (Visual Basic의Shared ) 멤버는 스레드로부터 안전합니다. 모든 인스턴스 멤버는 스레드로부터 안전하지 않을 수도 있습니다.

참고 항목

참조

FormErrorCollection 멤버

Microsoft.Office.InfoPath 네임스페이스