Adding TextBoxField to Table Cell

I’m trying to add a textboxfield to a cell, but receiving a null reference exception error. Here is the code:

Dim commentTbRow As Row = ana_tbl.Rows.Add
commentTbRow.FixedRowHeight = 80
Dim commentTbCell As Cell = New Cell
commentTbCell.ColSpan = 6

    Dim textBoxField11 As TextBoxField = New TextBoxField()

    textBoxField11.PartialName = "Comment_tb"
    textBoxField11.Value = ""
    textBoxField11.Height = 70
    textBoxField11.Multiline = True
    textBoxField11.Width = 500

    commentTbCell.Paragraphs.Add(textBoxField11)
    commentTbRow.Cells.Add(commentTbCell)

Can you please tell me where I’m going wrong?

Thanks!

Hi Jason,


Thanks for your inquiry. We have tested the scenario and noticed that API throws exception upon setting TextBoxField value to empty. So we have logged a ticket PDFNEWNET-38686 in our issue tracking system for correction. However, If you do not want to set any value at the time of field generation then you may either set it to “null” or do not set value at all, it will help you to resolve the issue.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNET-38686) have been fixed in Aspose.PDF for .NET 23.4.