Define a public int value - InfoPath Dev
in

InfoPath Dev

Define a public int value

Last post 07-06-2010 05:30 AM by alexia_net. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-06-2010 05:16 AM

    Define a public int value

    Hi. How do I define a global variable of type int in C# in infopath?   I have tried like this

            private object _intNoNodes
            {
                get
                {
                    return FormState["_intNoNodes"];
                }
                set
                {
                    FormState["_intNoNodes"] = value;
                }
            }

    but i get an error saying that:

    Operator '+' cannot be applied to operands of type 'object' and 'int'

    when I do something like this:

     intNoNodes = intNoNodes+1.

    Thank you!

  • 07-06-2010 05:24 AM In reply to

    Re: Define a public int value

    Change object to int and put (int) before the word FormState in the get{} block.

    You'll need to assign an initial value to this variable before accessing it or you'll get an InvalidCastException.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-06-2010 05:30 AM In reply to

    Re: Define a public int value

     Thank you very much!

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.