Skip to main content

Access a Document in a VB.NET script


QAID # 10371 Published

Question / Problem:

In a SoftBridge Basic Language(SBL) Validation Script, I was able to access the Document via the KfxAcmDocument object.

How is this done in a VB.NET script?

Answer / Solution:

In a VB.NET script, you will need to declare a Document object as a class variable:     

Dim MyDoc As Document

Then, set this variable to the active Document in the DocumentPreProcessing event. The active Document is passed to the DocumentPreProcessing event as a property of the Kofax.AscentCapture.Scripting.PredocumentEventArgs object. Within this event, you can set the Document class variable to the current Document object like so:

Private Sub TestDoc_DocumentPreProcessing(ByVal sender As Object, _
                              ByVal e As Kofax.AscentCapture.Scripting.PredocumentEventArgs) _
                              Handles Me.DocumentPreProcessing

      MyDoc = e.Document

End Sub 

The variable is now available in any of the following field events of this current document. For example, below is a FieldPreProcessing event for a field named "Name":

Private Sub Name_FieldPreProcessing(ByVal sender As Object, _

                              ByVal e As Kofax.AscentCapture.Scripting.PreDocumentEventArgs) _
                              Handles Name.FieldPreProcessing 
Dim MyString As String

    MyString = MyDoc.FormName

End Sub 

Applies to:

Product Version
  • Was this article helpful?