Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Phil Crowe 192 posts 256 karma points
    Oct 28, 2010 @ 15:28
    Phil Crowe
    0

    Converting label or textstring to int

    Ive created a new label in a document called 'worthATry'. This label stores an integer. when i try calling this property into a variable in c# i get "Object reference not set to an instance of an object" error, but when i try a different property like a tickbox (returning 1 or 0) it works perfectly. is there a reason i cannot convert a textsring or label to an int?

     int INT3 = Convert.ToInt32(n.GetProperty("worthATry").Value); // doesnt work

     int INT3 = Convert.ToInt32(n.GetProperty("tickbox ").Value); //does work

     i have definitely used the correct alias for the property.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 28, 2010 @ 18:51
    Sebastiaan Janssen
    0

    The error comes from the getProperty call, the property obviously can't be found so you can't get the .Value either. 

    Check the casing of the "worthATry" property on the document type with the alias in your code.

  • Phil Crowe 192 posts 256 karma points
    Nov 04, 2010 @ 17:58
    Phil Crowe
    0

    I dont know why this was happening. after i try getting the value in an onboundevent and setting a label with the value it worked.

Please Sign in or register to post replies

Write your reply to:

Draft