bhartiya arya samaj
bhartiya arya samaj

Reputation: 151

Accessing a list of Textboxes

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

Upvotes: 12

Views: 523

Answers (5)

Arshad
Arshad

Reputation: 1

How you are referring to pdf? is it saved in your database? or you are referring to it externally?

if its saved in your database you can access it using binary Serialization. if externally,Adobe pro has has a link button that connects pdf files to your web service using URL(you need to do jscript pdf coding on pdf)

You might also want to see PDFOne app that access pdf fields in an easy way.

Thanks

Upvotes: 0

David R.
David R.

Reputation: 280

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]);
        }

    }

Upvotes: 1

Malkaviano
Malkaviano

Reputation: 134

It's very hard to understand what you did and what you want to do, but looks like you just need to use the SelectedValue of the comboBox and compare/get the right object with that "id".

In your example it looks like the 24, 26 and 1010. The output you got there is probably the Object.ToString().

Don't forget combos have a selected value (you should store the key) and the selected text. Forget the text and go for the key the use field.BasedataObject.Key

Upvotes: 0

Syed Fahad Ali
Syed Fahad Ali

Reputation: 59

You can create a class with 3 properties as following class Signature { string Signature1, string fullname, object baseobject } may have get and set too

this will help you combine all the value and can have helping method in this class too

Upvotes: 0

pnk
pnk

Reputation: 35

Why don't you have a struct for Signature?

struct Signature
{
Signature1,
Field1,
Field2
};

You can compare these struct variables then.

Upvotes: 0

Related Questions