officefileapi-devexpress-dot-pdf-dot-pdfacroformfacade-dot-getcomboboxformfield-x28-system-dot-string-x29.md
Gets a specific combo box form field’s properties.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfComboBoxFormFieldFacade GetComboBoxFormField(
string fullName
)
Public Function GetComboBoxFormField(
fullName As String
) As PdfComboBoxFormFieldFacade
| Name | Type | Description |
|---|---|---|
| fullName | String |
A form field’s name.
|
| Type | Description |
|---|---|
| PdfComboBoxFormFieldFacade |
An object that contains the form field’s properties.
|
The PdfComboBoxFormFieldFacade object contains form field and widget properties without access to the form field’s inner structure. Use the Widgets property to get the form field widget settings.
The code sample below specifies the combo box value and disables multiple selection:
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf");
PdfDocumentFacade documentFacade = pdfDocumentProcessor.DocumentFacade;
PdfAcroFormFacade acroForm = documentFacade.AcroForm;
//Set combo box field value:
PdfComboBoxFormFieldFacade nationalityField = acroForm.GetComboBoxFormField("Nationality");
nationalityField.Value = nationalityField.Items[68].Value;
//Disable user input:
nationalityField.Editable = false;
//Disable multiple selection:
nationalityField.MultiSelect = false;
//Sort list items alphabetically:
nationalityField.Sorted = true;
pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf");
}
Using pdfDocumentProcessor As New PdfDocumentProcessor()
pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf")
Dim documentFacade As PdfDocumentFacade = pdfDocumentProcessor.DocumentFacade
Dim acroForm As PdfAcroFormFacade = documentFacade.AcroForm
'Set combo box field value:
Dim nationalityField As PdfComboBoxFormFieldFacade = acroForm.GetComboBoxFormField("Nationality")
nationalityField.Value = nationalityField.Items(68).Value
'Disable user input:
nationalityField.Editable = False
'Disable multiple selection:
nationalityField.MultiSelect = False
'Sort list items alphabetically:
nationalityField.Sorted = True
pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf")
End Using
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetComboBoxFormField(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
pdf-document-api-fill-interactive-form-fields/CS/PdfFormFilling/PdfFormFilling.cs#L68
PdfComboBoxFormFieldFacade countryField = acroForm.GetComboBoxFormField("Address.Country");
countryField.Value = countryField.Items[0].Value;
pdf-document-api-fill-interactive-form-fields/VB/PdfFormFilling/PdfFormFilling.vb#L62
Dim countryField As PdfComboBoxFormFieldFacade = acroForm.GetComboBoxFormField("Address.Country")
countryField.Value = countryField.Items(0).Value
See Also