sorcerer7
Joined: 06 Feb 2009 Posts: 6 Location: Plano Texas
|
Posted: Fri Feb 06, 2009 10:35 pm Post subject: How to Read/ Set Radio Button on AcroForm |
|
|
I have an AcroFrom that has several groups of radio buttons and I am currently unable to set the value using code. One of the groups of radio buttons is named "male or female".
I am using PDFSharp v1.2
Code: |
// Get the root object of all interactive form fields
PdfAcroForm form = document.AcroForm;
// Get all form fields of the whole document
PdfAcroField.PdfAcroFieldCollection fields = form.Fields;
// Get all form fields of the whole document
string[] names = fields.Names;
names = fields.DescendantNames;
string fqName;
PdfAcroField field;
PdfRadioButtonField radField;
fqName = "male or female";
field = fields[fqName];
radField = field as PdfRadioButtonField; |
What would I need here to read the value or set the value of the PdfRadioButton radField?
What if anything should I be doing differently?
I am able to set text fields and checkboxes without any issue using:
Code: |
PdfTextField txtField;
PdfCheckBoxField chkField;
fqName = "nameoftextfieldtobeset(0)";
field = fields[fqName];
txtField = field as PdfTextField;
txtField.Text = "text value being set";
fqName = "nameofcheckboxtobeset(0)";
field = fields[fqName];
chkField = field as PdfCheckBoxField;
chkField.Checked = true; |
Thanks,
Chris |
|