exceptions while accessing properties of PdfFormField

exceptions while accessing properties of PdfFormField

Forum member · Dec 19, 2005
I have the following code, designed to find a text field with a certain portion of its name: Friend Shared Function GetPdfFormField(ByVal pdfdoc As PdfDocument, ByVal partialName As String) As PdfFormField Dim pdfId As PdfDocument = pdfdoc Dim mergeOptionsId As New ceTe.DynamicPDF.Merger.MergeOptions(True) Dim mergeId As MergeDocument = New MergeDocument(pdfId, mergeOptionsId) Dim fieldsList As PdfFormFieldList = pdfId.Form.Fields Dim numFields As Int32 = fieldsList.Count Dim thePDFField As PdfFormField Dim fieldObj As Ramp.RampWeb.PDFField For num As Int32 = 0 To numFields - 1 thePDFField = fieldsList(num) If thePDFField.Name.IndexOf(partialName) > -1 Then Return thePDFField End If Next Return Nothing End Function It finds the field correctly, but when I need its entire name, or try to find other properties (as in the Immediate window clip shown below) I get the following exceptions.. ? thePdffield.GetValue Run-time exception thrown : System.ArgumentException - Cannot find the method on the object instance. ? thePdffield.Name <error: an exception of type: {System.ArgumentException} occurred> ? thePdffield.GetOriginalPageNumber 'GetOriginalPageNumber' is not a member of 'PdfFormField'. If it helps in diagnosing, there are some exceptions that occur as the web app is starting up, regarding access exceptions to the dlls, but these never make it to the UI, nor do they stop any other form field code from working. What's going on here ?

Re: exceptions while accessing properties of PdfFormField

Support · Dec 19, 2005
Hello, Can you please tell us exactly where you are getting the error? If possible please send us over the PDF document you are trying to fill and the entire code snippet at [^a|mailto:support@cete.com|Support^], so that we can take a look into it. Make sure you are trying to access the PdfFormField properties after you set "thePDFField = fieldsList(num)". Thanks, ceTe Software Support Team