Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing a list of Textboxes

Tags:

c#

winforms

I have three signature fields in my PDF. I am taking values from a ComboBox in my Windows Forms apps for this.

The ComboBox has:

  Signature 1
  Signature 2
  Signature 3

For the signature fields, I have a property:

 field.fullname;
 field.baseobject;

Which gives me the full name of the field, e.g.

 Signature 1
 ...

I want to compare these two on the Click of the Save button; that is, if signature field 1 is selected, the data should be added to the signature field1 only, and so on.

How do I do this?

I tried using field.BasedataObject, and I found the following

<24 0 R> - 1st field
<26 0 R> - 2nd field
<1010 0 R> - 3rd field
like image 865
bhartiya arya samaj Avatar asked Dec 03 '12 11:12

bhartiya arya samaj


1 Answers

It looks like a simple solution would be to create a class for Signature (using your necessary properties) then create an array of signatures. Use that array of Signatures to populate your combobox in the first place (maintaining integrity of your system) then use the id from selected value of the combobox to compare to the array index. Something like this:

public class Signature{
    string property1;
    string property2;

    public Signature(string propertyVal1, string propertyVal2)
    {
        property1 = propertyVal1;
        property2 = propertyVal2;
    }

}

    Signature[] mySignatures = new Signature[3];

    public Form1()
    {
        InitializeComponent();
        mySignatures[0] = new Signature("hello", "world");
        mySignatures[1] = new Signature("hello", "world");
        mySignatures[2] = new Signature("hello", "world");
        for (int i = 0; i < mySignatures.Length; i++)
        {
            comboBox1.Items.Add(mySignatures[i]);
        }

    }
like image 151
David R. Avatar answered Sep 20 '22 08:09

David R.